Repository navigation
Open pin-bump PRs with the developer App token - #4678
Draft
pithead-developer[bot] wants to merge 7 commits into
Draft
pithead-developer[bot] wants to merge 7 commits into
pithead-developer[bot] wants to merge 7 commits into
Conversation
The Tor and shipped-pin bump workflows run in the pin-bump environment and mint a token for the developer App with contents and pull-request write on this repository only. That token pushes the bump branch, opens its PR and closes superseded ones; GITHUB_TOKEN keeps read access only. Each run first checks that PIN_BUMP_APP_ID and PIN_BUMP_APP_KEY are set and fails with a message naming the missing one before it pushes anything. The superseded-PR helpers treat the App's PRs as their own, the PR bodies say tiers 1 to 3 run as the PR's own checks, and docs/dev/releasing.md describes the one-time setup. make test-tools checks that both bump jobs keep this shape. Fixes #4677 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The App token is minted with the client ID (PIN_BUMP_APP_CLIENT_ID), the current input of create-github-app-token. The PR lookups and the superseded helpers take only pull requests from this repository, and the helpers trust the developer App only in its app/ and [bot] logins. A run that fails after the token is minted comments on, or opens, an infra tracking issue named after the workflow. The test-tools check also refuses secrets.GITHUB_TOKEN and requires the pull-request permission and the failure report, and the self-tests cover fork PRs, a bare login and App PRs on other heads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checkout is the first step of both bump jobs, and the failure report runs on any failure: it uses the App token when the run minted one and the Actions token otherwise, with the job's issues permission, so a missing setting or a revoked key also reaches the infra tracking issue. The state lookups read up to 200 pull requests before they drop the ones from forks. The test-tools check allows github.token only in that one fallback line and requires the issues permission and checkout before the settings check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test-tools check now requires the job-level issues permission the failure report falls back on, and the fallback GH_TOKEN line exactly once. docs/dev/releasing.md says a missing setting fails the run at the settings check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ow serves Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…HIGH finding Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
|
FAIL What I investigatedThe bench-ci evidence this diff requires is missing, stale or still running at the head, so the runner returned the PR before any reviewer session. Reviewed head: What are the gaps
|
Contributor
Author
|
Blocked on p2pool-starter-stack/bench-ci#2905: tier4-e2e jobs 4888 and 4894 on head 8a8d8bc both errored at preflight ( |
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.
What's the problem
The Tor and shipped-pin bump workflows find a newer upstream, push a
bot/…branch and then fail atgh pr create: the repository keeps "Allow GitHub Actions to create and approve pull requests" off, soGITHUB_TOKENcannot open the pull request each workflow exists to open. The branches sit on the remote and nobody is told, and the PRs the token did open triggered no checks of their own.How I fixed it
bumpjobs run in thepin-bumpenvironment and mint a developer App token withactions/create-github-app-token(pinned by commit), withcontents: write,pull-requests: writeandissues: writeon this repository only. That token pushes the branch, opens the PR and closes superseded ones. Pushes and PRs made with it start the PR's own checks.GITHUB_TOKENkeepscontents: readand gainsissues: writefor the failure report; it writes nothing else. In the shipped-pin workflow the release lookup uses the App token too.PIN_BUMP_APP_CLIENT_IDand the secretPIN_BUMP_APP_KEYare set, and fails with an error naming the missing one before it pushes anything. The repository setting stays off.scripts/watch/tor-bump.sh,scripts/watch/pin-bump.sh) count PRs by the developer App as their own, alongside the Actions bot, so a newer bump still closes the older one. They match only same-repo bump PRs on their ownbot/heads, and take the App only in itsapp/pithead-developerandpithead-developer[bot]logins; the workflows' own PR lookups also skip PRs from forks.infratracking issue named after the workflow (per component for the shipped pins), with a link to the run. Checkout is the first step, and the report uses the App token when the run minted one and the Actions token otherwise, which may open issues, so a missing setting or a revoked key is reported too.docs/dev/releasing.mddescribes the one-time setup.make test-toolschecks both workflow files: the job runs in thepin-bumpenvironment, checks out first, checks the settings before the push step, mints the App token with the pull-request and issues permissions, reports every failed run, and namesgithub.tokenorGITHUB_TOKENonly on the one fallback line, which must appear exactly once, with the job's ownissues: writethat it relies on.What to know:
pin-bump, limited to thedevelopbranch, with the variablePIN_BUMP_APP_CLIENT_ID(the App's client ID) and the secretPIN_BUMP_APP_KEY, a private key of the App made for this use alone, so it can be revoked without touching the App's other keys. Neither exists at repository level, and the environment's branch rule means a run, a dry run included, works only fromdevelop. Without them both workflows fail at the settings check with that message, before they push anything.bot/xmrig-proxy-v6.27.0branch becomes a PR on the next run: the step adopts a branch whose tip is a pin-only commit.bot/tor-0.4.9.18-r0is not needed once Twenty-nine fixes for 2.0.5 in one pull request, one commit each #4668, which carries the same pin, merges.Part of #4677
Here is the proof
Head
bd35be94, ondevelop495c6d3.uvx zizmor@1.25.2 --offline .github/workflows/(the version CI runs): no findings.make test-tools: passes, including both watch self-tests and the new workflow check.bot/head; the App's PRs exempted from the head match; fork PRs counted; a barepithead-developerlogin trusted; the environment line removed; an addedgithub.tokenorsecrets.GITHUB_TOKENin any write step; the report step without its fallback or limited to runs that minted a token; the fallback line copied into another step; the App token's pull-request or issues permission removed; the job's ownissues: writeremoved; checkout moved after the settings check; the settings check moved after the push step; the failure report removed. Not covered: the check counts the fallback line but does not tie it to the report step, so moving that one line into the push step while the report keeps only the App token would pass it.make lint-yaml,lint-md,lint-docs-voiceandlint-path-references: pass.workflow_dispatchof "Shipped pin bump" fromdevelopwithdry_runon mints the App token in thepin-bumpenvironment and pushes nothing; it is the first run that uses the key. The next scheduled Tor or pin bump that finds a newer upstream then opens a real PR.Models: claude-opus-5-5 (developer)
🤖 Generated with Claude Code