Skip to content

ci: replace shellcheck and actionlint with nix flake check #323

ci: replace shellcheck and actionlint with nix flake check

ci: replace shellcheck and actionlint with nix flake check #323

Workflow file for this run

name: lint
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
jobs:
flake-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15
with:
name: edgelesssys
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Run nix flake check
run: |
nix -L flake check
go-tidy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Go environment
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version: "stable"
- uses: katexochen/go-tidy-check@427c8c07d3d83ab8d7290cad04ce71c12eab3674 # v2.0.1
govulncheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Go environment
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version: "stable"
- name: Run govulncheck
shell: bash
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
vendorhash:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
token: ${{ !github.event.pull_request.head.repo.fork && secrets.UPLOSI_CI_COMMIT_PUSH_PR || '' }}
- uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
- name: Update uplosi vendor hash
run: nix run .#nixpkgs.nix-update -- --flake --version=skip uplosi
- name: Check diff
id: check-diff
run: |
diff=$(git diff)
if [[ -z "$diff" ]]; then
echo "Everything is tidy and generated."
exit 0
fi
cat << EOF >> "${GITHUB_STEP_SUMMARY}"
\`\`\`diff
${diff}
\`\`\`
EOF
echo "::error::vendorHash out of date"
exit 1
- name: Push changes
if: |
failure() &&
(steps.check-diff.conclusion == 'failure') &&
startsWith(github.head_ref, 'renovate/') &&
(!github.event.pull_request.head.repo.fork)
run: |
git config --global user.name "edgelessci"
git config --global user.email "[email protected]"
git commit -am "flake: update uplosi vendorHash"
git push