From 78d55f3ed8ed50c018f81dc4bcf04ce30586d4bd Mon Sep 17 00:00:00 2001 From: Michael I Chen Date: Tue, 27 Oct 2026 20:32:30 -0700 Subject: [PATCH 1/3] ci: pin actions that hold write tokens Pin each third-party action that runs with a write token to the commit its major tag points to today: peter-evans/create-pull-request, iarekylew00t/verified-bot-commit, softprops/action-gh-release, googleapis/release-please-action and crazy-max/ghaction-import-gpg, wherever this repository uses them. A major tag can be moved to any commit, and these actions write to the repository or handle the release signing key. Every other action still floats on its major. Dependabot updates the commit and its version comment, and its cooldown applies to these updates as to any other. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/pre-commit-autoupdate.yml | 3 ++- .github/workflows/release-pr.yml | 3 ++- .github/workflows/release-publish.yml | 3 ++- .github/workflows/release-tag.yml | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pre-commit-autoupdate.yml b/.github/workflows/pre-commit-autoupdate.yml index 5d483ae..8e9b885 100644 --- a/.github/workflows/pre-commit-autoupdate.yml +++ b/.github/workflows/pre-commit-autoupdate.yml @@ -91,7 +91,8 @@ jobs: echo "default_branch=$DEFAULT" >> "$GITHUB_OUTPUT" - name: Commit changes if: steps.autoupdate-pre-commit.outputs.has_updates == 'true' - uses: iarekylew00t/verified-bot-commit@v2 + # Pinned to a commit because it runs with a write token; Dependabot bumps it. + uses: iarekylew00t/verified-bot-commit@1ee4374942e5c5f814e9b3121d766cbe45cea360 # v2.3.6 with: message: 'chore(pre-commit): bump hook versions' files: | diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index 5018ac5..a14fbe2 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -296,7 +296,8 @@ jobs: - name: Create release PR id: cpr - uses: peter-evans/create-pull-request@v8 + # Pinned to a commit because it runs with a write token; Dependabot bumps it. + uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 with: branch: ${{ needs.resolve.outputs.branch }} base: main diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 1694e4d..b1f8e4c 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -70,7 +70,8 @@ jobs: uses: sigstore/cosign-installer@v3 - name: Import release GPG key - uses: crazy-max/ghaction-import-gpg@v7 + # Pinned to a commit because it runs with a write token; Dependabot bumps it. + uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0 with: gpg_private_key: ${{ secrets.RELEASE_GPG_PRIVATE_KEY }} passphrase: ${{ secrets.RELEASE_GPG_PASSPHRASE }} diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index c9302f8..6fd26a4 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -51,7 +51,8 @@ jobs: echo "tag=$tag" >> "$GITHUB_OUTPUT" - name: Import release GPG key - uses: crazy-max/ghaction-import-gpg@v7 + # Pinned to a commit because it runs with a write token; Dependabot bumps it. + uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0 with: gpg_private_key: ${{ secrets.RELEASE_GPG_PRIVATE_KEY }} passphrase: ${{ secrets.RELEASE_GPG_PASSPHRASE }} From 65737eba88c83a03925fc1f0c7b6fb5941a272dc Mon Sep 17 00:00:00 2001 From: Michael I Chen Date: Tue, 27 Oct 2026 20:32:33 -0700 Subject: [PATCH 2/3] ci: build the changelog in a read-only job Split changelog-autoupdate.yml into two jobs. `generate` installs git-cliff and markdownlint, regenerates CHANGELOG.md under a read-only token with no persisted credentials, and uploads the file. The `pull-request` job, which holds contents and pull-requests write, runs only checkout, download-artifact and create-pull-request, pinned to a commit. The id-token grant goes, since no step requests an OIDC token. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/changelog-autoupdate.yml | 28 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/changelog-autoupdate.yml b/.github/workflows/changelog-autoupdate.yml index 2e71497..26beffe 100644 --- a/.github/workflows/changelog-autoupdate.yml +++ b/.github/workflows/changelog-autoupdate.yml @@ -6,20 +6,21 @@ on: workflow_dispatch: permissions: - contents: write - pull-requests: write - id-token: write + contents: read env: BRANCH_NAME: chore/changelog-autoupdate jobs: - changelog-autoupdate: + # Builds the changelog under a read-only token, so the tools it installs never + # run beside the write token that opening the pull request needs. + generate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 with: fetch-depth: 0 # Full history needed for git cliff + persist-credentials: false # Temporary; see the note in release-pr.yml and tracking issue #87. Pinned # only because 2.14.x drops commits that touch .git-blame-ignore-revs # alone (orhun/git-cliff#1643). Drop the pin once that ships rather @@ -36,8 +37,25 @@ jobs: config: .markdownlint.yml globs: | CHANGELOG.md + - uses: actions/upload-artifact@v7 + with: + name: changelog + path: CHANGELOG.md + + pull-request: + needs: generate + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - uses: actions/checkout@v7 + - uses: actions/download-artifact@v8 + with: + name: changelog + # Pinned to a commit because it runs with a write token; Dependabot bumps it. - name: Push changes and create PR - uses: peter-evans/create-pull-request@v8 + uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 with: branch: '${{ env.BRANCH_NAME }}' sign-commits: true From c0d47d76d6277430c08b90b9ae939b8f76b0abad Mon Sep 17 00:00:00 2001 From: Michael I Chen Date: Tue, 27 Oct 2026 20:58:22 -0700 Subject: [PATCH 3/3] ci: drop the pin comments The `# vX.Y.Z` after each pinned commit stays; Dependabot reads it. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/changelog-autoupdate.yml | 1 - .github/workflows/pre-commit-autoupdate.yml | 1 - .github/workflows/release-pr.yml | 1 - .github/workflows/release-publish.yml | 1 - .github/workflows/release-tag.yml | 1 - 5 files changed, 5 deletions(-) diff --git a/.github/workflows/changelog-autoupdate.yml b/.github/workflows/changelog-autoupdate.yml index 26beffe..bacc61b 100644 --- a/.github/workflows/changelog-autoupdate.yml +++ b/.github/workflows/changelog-autoupdate.yml @@ -53,7 +53,6 @@ jobs: - uses: actions/download-artifact@v8 with: name: changelog - # Pinned to a commit because it runs with a write token; Dependabot bumps it. - name: Push changes and create PR uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 with: diff --git a/.github/workflows/pre-commit-autoupdate.yml b/.github/workflows/pre-commit-autoupdate.yml index 8e9b885..c5f148d 100644 --- a/.github/workflows/pre-commit-autoupdate.yml +++ b/.github/workflows/pre-commit-autoupdate.yml @@ -91,7 +91,6 @@ jobs: echo "default_branch=$DEFAULT" >> "$GITHUB_OUTPUT" - name: Commit changes if: steps.autoupdate-pre-commit.outputs.has_updates == 'true' - # Pinned to a commit because it runs with a write token; Dependabot bumps it. uses: iarekylew00t/verified-bot-commit@1ee4374942e5c5f814e9b3121d766cbe45cea360 # v2.3.6 with: message: 'chore(pre-commit): bump hook versions' diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index a14fbe2..6c85f82 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -296,7 +296,6 @@ jobs: - name: Create release PR id: cpr - # Pinned to a commit because it runs with a write token; Dependabot bumps it. uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 with: branch: ${{ needs.resolve.outputs.branch }} diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index b1f8e4c..276e311 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -70,7 +70,6 @@ jobs: uses: sigstore/cosign-installer@v3 - name: Import release GPG key - # Pinned to a commit because it runs with a write token; Dependabot bumps it. uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0 with: gpg_private_key: ${{ secrets.RELEASE_GPG_PRIVATE_KEY }} diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index 6fd26a4..fa60545 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -51,7 +51,6 @@ jobs: echo "tag=$tag" >> "$GITHUB_OUTPUT" - name: Import release GPG key - # Pinned to a commit because it runs with a write token; Dependabot bumps it. uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0 with: gpg_private_key: ${{ secrets.RELEASE_GPG_PRIVATE_KEY }}