Skip to content

ci: keep release tools away from the write token - #124

Merged
michen00 merged 9 commits into
mainfrom
ci/release-read-only-build
Oct 28, 2026
Merged

michen00 merged 9 commits into
mainfrom
ci/release-read-only-build

Conversation

@michen00

Copy link
Copy Markdown
Owner

Summary

Both release workflows ran third-party tools in jobs that hold contents write. release-pr.yml ran git-cliff, pre-commit, prettier and the test suite beside the token that opens the release PR, and release-publish.yml built, 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 new prepare job checks out without persisted credentials, stamps the changelog, bumps the pins, runs the formatters, hooks and tests, and uploads CHANGELOG.md and README.md. 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.
  • release-publish.yml: three jobs. build resolves the tag, checks it out and builds under a read-only token. sign waits on the release environment, imports the release key, installs cosign and signs under an OIDC token with no write access. Only release-publish holds contents write, and it runs download-artifact and gh.
  • The comment in scripts/release/approve.sh now names the signing job as the one that holds the key.

Testing

  • The pre-commit hooks pass on the changed files, including actionlint, which checks the needs output references.
  • tests/test-release-approve.sh passes.
  • These workflows run only during a release, so the first release after this merges is their first run.

Review focus & risk

  • The release environment gate moves from the single job to sign. A run still asks for one approval, and approve.sh finds the waiting run as before, since it looks for runs rather than jobs. build now runs before that approval; it holds no key and cannot write.
  • Artifacts pass between jobs through upload-artifact and download-artifact, so the bytes signed and uploaded are the bytes build produced.

🤖 Generated with Claude Code

michen00 and others added 4 commits October 27, 2026 20:32
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>
Repository owner deleted a comment from qodo-code-review Bot Oct 28, 2026
michen00 and others added 3 commits October 27, 2026 20:58
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>
Base automatically changed from ci/pin-writer-actions to main October 28, 2026 04:05
michen00 and others added 2 commits October 27, 2026 21:28
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.19%. Comparing base (29d1641) to head (65b2888).

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           
Flag Coverage Δ
integration 0.73% <ø> (ø)
unit 49.71% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@michen00
michen00 merged commit 564cb8f into main Oct 28, 2026
16 checks passed
@michen00
michen00 deleted the ci/release-read-only-build branch October 28, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants