Repository navigation
ci: keep release tools away from the write token - #124
Merged
Merged
Conversation
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
Split release-pr.yml's release-pr job in two. `prepare` checks out without persisted credentials, stamps the changelog, bumps the pins, runs the formatters, hooks and tests, and uploads the files the release PR commits. `release-pr` holds contents and pull-requests write and runs only checkout, download-artifact, the body render, create-pull-request and the superseded-PR cleanup. The workflow-level token is now read-only, so `resolve` no longer narrows its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Split release-publish.yml's one job into three. `build` resolves the tag, checks it out and builds the artifacts under a read-only token. `sign` waits on the `release` environment, imports the release key and signs with cosign under an OIDC token but no write access. Only `release-publish` holds contents write, and it runs download-artifact and gh. The approval prompt is unchanged: one per run, now on `sign`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The `# vX.Y.Z` after each pinned commit stays; Dependabot reads it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The `# vX.Y.Z` after each pinned commit stays; Dependabot reads it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #124 +/- ##
=======================================
Coverage 50.19% 50.19%
=======================================
Files 33 33
Lines 2598 2598
=======================================
Hits 1304 1304
Misses 1294 1294
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Both release workflows ran third-party tools in jobs that hold contents write.
release-pr.ymlran git-cliff, pre-commit, prettier and the test suite beside the token that opens the release PR, andrelease-publish.ymlbuilt, installed cosign and imported the release key in the job that uploads assets. This moves that work into jobs without write access. It builds on #123.Changes
release-pr.yml: a newpreparejob checks out without persisted credentials, stamps the changelog, bumps the pins, runs the formatters, hooks and tests, and uploadsCHANGELOG.mdandREADME.md.release-prholds contents and pull-requests write and runs only checkout, download-artifact, the body render, create-pull-request and the superseded-PR cleanup. The workflow-level token is now read-only.release-publish.yml: three jobs.buildresolves the tag, checks it out and builds under a read-only token.signwaits on thereleaseenvironment, imports the release key, installs cosign and signs under an OIDC token with no write access. Onlyrelease-publishholds contents write, and it runs download-artifact andgh.scripts/release/approve.shnow names the signing job as the one that holds the key.Testing
needsoutput references.tests/test-release-approve.shpasses.Review focus & risk
releaseenvironment gate moves from the single job tosign. A run still asks for one approval, andapprove.shfinds the waiting run as before, since it looks for runs rather than jobs.buildnow runs before that approval; it holds no key and cannot write.buildproduced.🤖 Generated with Claude Code