From 702cd534d24d5ac579f2926c15f44b5d58314fe9 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Fri, 20 Nov 2026 15:25:18 +0100 Subject: [PATCH] ci: lint workflows with jactionlint, shellcheck and zizmor Co-Authored-By: Claude Opus 5.5 --- .github/workflows/build.yaml | 60 +++++++++++++++++++++++++++++------- mise.toml | 4 +++ 2 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 mise.toml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a988eec8..9f98b775 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -9,7 +9,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.ref }} - cancel-in-progress: true + cancel-in-progress: ${{ github.event_name == 'pull_request' }} env: DRY_RUN: ${{ github.ref != 'refs/heads/main' }} @@ -22,18 +22,50 @@ jobs: lint: runs-on: ubuntu-latest timeout-minutes: 10 + permissions: + contents: read + checks: write + steps: - name: ⚙️ Setup uses: containerbase/internal-tools/setup@fee63dbf779bca6bd95975e8a841b3ac027511d0 # v5.4.16 with: save-cache: true + # shellcheck is used by jactionlint for the `run` scripts + - name: Setup mise + uses: jdx/mise-action@236a21c3b91f5db6d4e174b348674a0f0caac06d # v5.2.9 + with: + install_args: jactionlint shellcheck zizmor + - run: pnpm oxfmt + - name: shellcheck + uses: reviewdog/action-shellcheck@950c9d71535c8c49e5c029c33a438ade63b9009c # v1.35.1 + with: + fail_level: any + reporter: github-pr-annotations + filter_mode: nofilter + path: | + bin + .husky + pattern: | + *.sh + check_all_files_with_shebangs: 'true' + + - name: Check workflow files + run: mise exec -- jactionlint --color + + - name: Run zizmor + run: mise exec -- zizmor --format github .github/ + env: + GH_TOKEN: ${{ github.token }} + build: needs: - lint runs-on: ubuntu-latest + timeout-minutes: 30 permissions: id-token: write packages: write @@ -41,14 +73,16 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + persist-credentials: false show-progress: false - uses: sigstore/cosign-installer@756fe2d284c7292c4e9b62c8a28f1e5629c59532 # v4.1.3 - name: Docker registry login if: env.DRY_RUN == 'false' - run: | - echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ env.OWNER }} --password-stdin + run: echo "${GITHUB_TOKEN}" | docker login ghcr.io -u "${OWNER}" --password-stdin + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Publish to ghcr.io uses: containerbase/internal-tools@fee63dbf779bca6bd95975e8a841b3ac027511d0 # v5.4.16 @@ -62,23 +96,27 @@ jobs: release: needs: build runs-on: ubuntu-latest + timeout-minutes: 10 permissions: contents: write steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + persist-credentials: false show-progress: false - name: Init run: ./bin/init.sh - - uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0 + - name: Release if: env.DRY_RUN == 'false' - with: - allowUpdates: true - body: See https://github.com/nodejs/node/releases/tag/v${{ env.VERSION }} for more changes - commit: ${{ github.sha }} - name: ${{ env.VERSION }} - tag: v${{ env.VERSION }} - token: ${{ secrets.GITHUB_TOKEN }} + run: | + notes="See https://github.com/nodejs/node/releases/tag/v${VERSION} for more changes" + if gh release view "v${VERSION}" > /dev/null 2>&1; then + gh release edit "v${VERSION}" --title "${VERSION}" --notes "${notes}" + else + gh release create "v${VERSION}" --target "${GITHUB_SHA}" --title "${VERSION}" --notes "${notes}" + fi + env: + GH_TOKEN: ${{ github.token }} diff --git a/mise.toml b/mise.toml new file mode 100644 index 00000000..61e4c067 --- /dev/null +++ b/mise.toml @@ -0,0 +1,4 @@ +[tools] +jactionlint = "2.6.0" +shellcheck = "0.11.0" +zizmor = "1.32.0"