Repository navigation
feat(ci): open, refresh and auto-merge the proxy chart-pin PR (#727) - #730
Merged
Merged
Conversation
#703 left one human step per proxy release: `proxy-release` pushed `chore/proxy-image-bump-<short sha>` and handed off a `gh pr create` one-liner, because `GITHUB_TOKEN` cannot open a PR here and a PR it opened would fire no `pull_request` events, so the `ci` + `proxy` checks the `main` ruleset requires would never report. Give the flow a user identity instead. `bump-chart` now declares `environment: release` and resolves a mode per run: * auto — `RELEASE_PAT` (fine-grained, this repo only, Contents RW + Pull requests RW) is present and the API accepts it. The branch is pushed with that token, `gh pr create` opens the PR (a user token's PR gets ordinary checks) and `gh pr merge --auto --squash` hands the merge to GitHub. The ruleset stays the only gate — nothing merges that is not green. Superseded `chore/proxy-image-bump-*` PRs are closed and their branches deleted, and #724 records the PR, the digest, the chart version and the token's remaining life. * manual — no token, an expired or rejected one, or a `gh pr create` that failed: byte-for-byte #703's hand-off, summary and #724 comment included, plus a row naming which of the three it was. A dead token degrades a release, it never fails one. A token-expiry sentinel reads `github-authentication-token-expiration` off `api.github.com/user`, warns under 30 days and forces manual mode once past the date; the token itself is never echoed and is re-masked defensively. `main-post-merge` gains `refresh-pin-prs`: auto-merge does not update a stale branch and the ruleset requires branches to be current, so a pin PR that goes `BEHIND` when anything else lands first would wait forever. The job runs `gh pr update-branch` on `BEHIND` pin PRs (which re-triggers CI, so auto-merge fires when it goes green), records `DIRTY` ones on #724 once and leaves them to a human, and touches nothing else. Both guards are required before it acts: the `chore/proxy-image-bump-*` head branch AND the `Auto-generated by the proxy-release run` body marker. `RELEASE_PAT` is an environment secret of `release` (deployment branches: `main` only), so a `pull_request` run — or a run of either workflow as edited on a branch — can never read it. GITHUB_TOKEN gains no `pull-requests: write`; it keeps `contents: write` for the manual push and `issues: write` for the #724 record, which the PAT deliberately cannot post. docs/runbook.md §7 documents both modes and the rotation procedure. Validated: `yaml.safe_load` on both workflows, `actionlint 1.7.7` with shellcheck 0.10.0 (clean), `make format-check`, and every branch of the new shell (token missing/healthy/near-expiry/expired/rejected, auto and manual PR bodies, BEHIND/DIRTY/CLEAN refresh, conflict-comment dedupe) exercised locally against stubbed `gh`/`curl`. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
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.
Closes #727. Removes the one human step #703 left: after a proxy release the pin
PR is now opened, kept current with
main, and squash-merged the momentci+proxy+proxy-pinare green. No classic PAT, no ruleset bypass, no repositorysetting change.
Two modes, decided per run
proxy-release/bump-chartgains a first step, Resolve release token,that sets
mode=auto|manual:RELEASE_PATis present and bothgh auth statusandgh api useraccept it. The chart-pin branch is pushed with that token,
gh pr createopensthe PR (a PR opened by a user token fires
pull_requestnormally, so therequired checks actually run) and
gh pr merge --auto --squashhands the mergeto GitHub. The
mainruleset — no bypass actors — remains the only gate: thiscan merge nothing that is not green. Other open
chore/proxy-image-bump-*PRsare closed with a "superseded by #N" comment and their branches deleted. proxy releases pending chart pin #724
gets the record: PR, digest, chart version, auto-merge state, superseded PRs,
run link and the token's remaining life.
gh pr createthatfailed. Byte-for-byte today's behaviour: the branch is pushed with
GITHUB_TOKENand the run summary + proxy releases pending chart pin #724 comment carry the exactgh pr createone-liner, now with a
| release token |row naming which of the three it was.A missing, expired or rejected token degrades the run — it never fails it.
The no-diff path (a re-run of an already-pinned sha) is unchanged, and so is
concurrency: proxy-release-main.Environment scoping — why a PR-branch run can never read the token
RELEASE_PATis an environment secret ofrelease, whose deployment-branchpolicy names
mainonly (issue addendum), and both consumers declareenvironment: release. GitHub injects environment secrets solely into jobs thatreference the environment and refuses to start such a job from any other ref — so
a
pull_requestrun, or a run of either workflow as edited on a branch, gets anempty
secrets.RELEASE_PATand takes the manual path. Concretely: this very PRcannot read the token. The residual is the one inherent to any post-merge secret —
a workflow change that reaches
mainthrough a green PR runs with it afterwards.Permissions stay tight:
GITHUB_TOKENkeepscontents: write(the manual push)and
issues: write(the #724 record) and gains nopull-requests: write—the PAT does the PR work. Conversely the PAT has no Issues permission, so every
#724 comment is posted with
GITHUB_TOKEN; that is whyrefresh-pin-prscarriesissues: writealongsidecontents: read.Expiry sentinel
curl -sSI -H "Authorization: Bearer $RELEASE_PAT" https://api.github.com/user,read
github-authentication-token-expiration, compute the days left:| release token |row on #724expires in 362 days (2027-09-03)::warning::RELEASE_PAT expires in 11 day(s) (2026-09-18) — rotate it (docs/runbook.md §7)**expires in 11 day(s)** (2026-09-18) — rotate the release environment secret (docs/runbook.md §7)::error::RELEASE_PAT expired on … — falling back to the manual hand-off+ mode=manualRELEASE_PAT expired on 2026-09-03 — rotate the release environment secret::notice::/::warning::+ mode=manualno RELEASE_PAT in the release environment/RELEASE_PAT was rejected by the APIThe token is never echoed and is
::add-mask::ed defensively on top of Actions'own masking; a
HEADrequest never reflects theAuthorizationheader back.Keeping the pin PR mergeable
main.yamlgainsrefresh-pin-prs(environment: release,if: always(), noneeds,contents: read+issues: write). Auto-merge does not update astale branch and the ruleset requires branches to be current, so a pin PR that
goes
BEHINDwhen anything else lands first would wait forever. For each open PRwhose head matches
chore/proxy-image-bump-*and whose body carries theAuto-generated by the proxy-release runmarker (both guards required, so it canonly ever touch PRs the release flow produced):
BEHIND→gh pr update-branch— that is an ordinarysynchronizefrom a usertoken, so
ci+proxyre-run and auto-merge fires when they go green;DIRTY→ a one-time comment on proxy releases pending chart pin #724 naming the PR (deduped by a<!-- pin-conflict:N -->marker), left for a human — this is thecharts/aether/Chart.yamlversion-taken conflict class;CLEAN/BLOCKED/ anything else → nothing.Validation
python3 -c 'import yaml,sys;yaml.safe_load(open(sys.argv[1]))'on bothworkflows;
actionlint1.7.7 withshellcheck0.10.0 — clean (the two SC2016 hits werejq string literals containing backticks; annotated
# shellcheck disable);make format-check— clean;gh/curl:token missing / healthy / <30d / expired / rejected, the auto and manual PR
bodies and proxy releases pending chart pin #724 comments rendered in full, and
BEHIND/DIRTY/BLOCKEDrefresh including the conflict-comment dedupe.
No
charts/change here (the merge commit only carriesmain's own).Note:
bump-chartdoes not run on this PR —proxy-releasetriggers onpush-to-
mainunderproxy/**/ its own file only — so CI here validates syntaxand the other jobs. The functional proof is the post-merge run: merging this PR
edits
.github/workflows/proxy-release.ymland therefore triggersproxy-release, which should publish the image and then auto-open andauto-merge the first pin PR, with the record on #724.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr