ci(drift): open the PR as a GitHub App so its checks actually run - #38
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 (Node ...) checks never reported and the PR was blocked on a report it could not receive. #34 has sat that way since 2026-09-02 while its body said 'build: 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. 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. Also corrects the comment left on ci.yml's workflow_dispatch trigger by the previous attempt. workflow_dispatch is genuinely a documented exception to the no-runs rule, and it does start a run — but that run's check runs do not satisfy branch protection. Measured, not assumed: on one 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 for two minutes, while a push-event run on the next commit cleared it at once. The trigger is kept because re-running CI against a ref by hand is useful; the claim that it fixes drift is removed. 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 required checks never reported and the PR was blocked on a report it could not receive. #34 has sat that way since 2026-09-02, its body cheerfully reportingbuild: 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 rather than taste.
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 with
push/pull_requeststripped from itsci.yml, so the only checks it could get were ones I gave it:workflow_dispatch8921fb59Test (Node 20/22/24)on the PR head SHApusha03bf181The dispatched run's checks were verifiably there:
Stable across six polls over two minutes, so not eventual consistency. Protection counts check runs by the event that produced their suite, not by SHA and name.
This PR also corrects the comment #36 left on
ci.yml'sworkflow_dispatchtrigger, which asserted the approach that turned out not to work. The trigger stays — re-running CI against a ref by hand is useful — but the claim goes.Verifying it
The mechanism can't be proven by this PR's own CI, only by a drift run. After merge I'll trigger the job manually. Two plausible first-run failures worth naming up front: 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 the corrected spec — ThemeParks/tpwserver#161 fixed the schedule and price schemas, which makes the currently-open #34 stale as well as unmergeable.
🤖 Generated with Claude Code