ci(drift): open the PR as a GitHub App so its checks actually run - #20
Merged
Merged
Conversation
The drift job opened its PR with GITHUB_TOKEN. GitHub does not start workflow runs from GITHUB_TOKEN-raised events, so the required test (3.x) checks never reported and the PR was blocked on a report it could not receive. #19 has sat that way since 2026-09-02 while its body said 'regenerate: success'. Fixed by minting a short-lived installation token from the tpw-drift app and handing it to create-pull-request. The push then comes from the app's identity rather than GITHUB_TOKEN, pull_request fires normally, and CI reports. The app holds contents:write and pull_requests:write on two repos and nothing else — notably not workflows:write, so it cannot alter CI. workflow_dispatch was tried first and rejected on evidence. It is a documented exception to the no-runs rule and does start a run, but that run's check runs do not satisfy branch protection: on a test PR a dispatched run put three successful check runs with the exact required names on the head SHA and left it BLOCKED with an empty rollup, while a push-event run on the next commit cleared it at once. The create-an-issue steps keep GITHUB_TOKEN deliberately. They open issues on failure, an issue does not need to trigger anything, and there is no reason to widen the app's reach. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
The drift job opened its PR with
GITHUB_TOKEN. GitHub does not start workflow runs fromGITHUB_TOKEN-raised events, so the requiredtest (3.x)checks never reported and the PR was blocked on a report it could not receive. #19 has sat that way since 2026-09-02, its body reportingregenerate: successthe whole time.Now the job mints a short-lived installation token from the
tpw-driftGitHub App and hands it tocreate-pull-request. The push comes from the app's identity,pull_requestfires normally, CI reports.The app holds
contents:write,pull_requests:write,metadata:readon two repos and nothing else — notably notworkflows:write, so it cannot alter CI. The token is minted per run and expires in an hour; the only stored credential is the app private key, revocable independently of any human account.The
create-an-issuesteps keepGITHUB_TOKENdeliberately. They open issues on failure, an issue doesn't need to trigger anything, and there's no reason to widen the app's reach.Why not workflow_dispatch
Tried first, rejected on evidence.
workflow_dispatchis documented as one of two exceptions to the no-runs rule, and the exception is real — the dispatch does start a run. It just doesn't satisfy branch protection.Measured on a throwaway PR in the JavaScript client with
push/pull_requeststripped from its CI workflow, so the only checks it could get were ones deliberately given to it:workflow_dispatchpushThe dispatched run's check runs were verifiably present on the SHA (
total_count=3, allcompleted/success, check suite reportinglinkedPRs=1), and the PR still readmergeable_state=blockedacross six polls over two minutes. Protection counts check runs by the event that produced their suite, not by SHA and name.The equivalent change for the JavaScript client is ThemeParks/ThemeParks_JavaScript#38.
Verifying it
The mechanism can't be proven by this PR's own CI, only by a drift run. After merge the job gets triggered manually. Two plausible first-run failures worth naming: a malformed private key fails at
create-github-app-token, and a repo missing from the app installation fails with "Resource not accessible by integration".That run also regenerates against a corrected upstream spec — the schedule-entry and price schemas were fixed server-side after #19 was generated, so #19 is now stale as well as unmergeable.
🤖 Generated with Claude Code