Skip to content

Keep the write token out of the build - #96

Open
madonoharu wants to merge 1 commit into
mainfrom
phase06/split-write-token
Open

Keep the write token out of the build#96
madonoharu wants to merge 1 commit into
mainfrom
phase06/split-write-token

Conversation

@madonoharu

Copy link
Copy Markdown
Owner

The expand job resolved dependencies and ran build scripts while holding contents, pull-requests and issues write, with the checkout credentials still on disk. Any build script in the dependency tree could have used them.

Split into three jobs so the write token is never in scope while arbitrary code runs:

  • expandcontents: read, persist-credentials: false. Regenerates the snapshots and hands the diff over as an artifact.
  • open-prcontents: write, pull-requests: write, and builds nothing. Applies the patch, pushes, opens the PR.
  • trackissues: write only. Closes or files the tracking issue based on needs.*.result.

Workflow-level permissions: {} so a job that forgets to declare them gets nothing.

While in there: the bot branch is now cut fresh from the target branch each run instead of being reset onto whatever it held, so a stale run can't resurrect an old snapshot.

Verified end to end

Ran it against a throwaway branch with a sentinel line added to borrow.expanded.rs, the same way #88 was verified. All three jobs passed, and the PR it opened contained exactly the sentinel removal, titled Update expanded test artifacts for wasm-bindgen 0.2.127, assigned and labelled. That PR and branch are cleaned up.

The no-op path is the one the nightly run takes normally: expand reports changed=false, open-pr is skipped, and track still closes the tracking issue — needs.open-pr.result is skipped, which the close condition treats as not-a-failure.

🤖 Generated with Claude Code

The expand job resolved dependencies and ran build scripts with
contents/pull-requests/issues write in scope, and with the checkout
credentials still on disk. Split it: expand is read-only and hands the
snapshot diff over as an artifact, open-pr holds the write permissions but
builds nothing, and track only touches issues.

The bot branch is now cut from the target branch each run rather than
reused, so a stale run cannot resurrect an old snapshot.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant