HW CI: fix fork-PR dispatch (pull_request_target)#746
Merged
Conversation
The label gate (#745) couldn't work for forks: a fork's `pull_request` workflow gets no repository secrets, so the dispatch step could never read HWCI_BRIDGE_TOKEN to reach tulipcc. Labeling a fork PR therefore did nothing (and the `labeled` event also raced the gate's own merge). Switch the trigger to `pull_request_target`, which runs in this repo's trusted context (has the secret) and always uses main's workflow. Safe because the job never checks out or runs the PR's code — it only reads head.sha + number and fires the cross-repo dispatch; fork code runs only downstream on the bench, which is what the `hwci-ok` label authorizes. Same-repo PRs are unaffected (they keep dispatching automatically); the label `if` gate is unchanged. Co-Authored-By: Claude Opus 4.8 <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 bug
The
hwci-oklabel gate (#745) can't actually bench a fork PR. Two reasons, found while debugging why labeling fork PR #744 did nothing:pull_requestworkflow is denied all repository secrets (GitHub's security model — only a read-onlyGITHUB_TOKEN). So the dispatch step can never readHWCI_BRIDGE_TOKEN, and the cross-repo dispatch to tulipcc is impossible from a fork. The label gate as written is structurally unable to work for forks.labeledevent evaluated the pre-gate workflow and fired nothing.The fix
Switch the trigger from
pull_requesttopull_request_target, which runs in this repo's trusted context — so it hasHWCI_BRIDGE_TOKENand always usesmain's workflow (no merge-ref race).Why this is safe (the usual
pull_request_targetfootgun does NOT apply)The classic
pull_request_targetvulnerability is checking out and running the PR's code while secrets are in scope. This job never does that — it has nocheckout, runs no PR code, and only readshead.sha(a hash) +number(an int) to fire the dispatch. The fork's code only ever runs downstream on the bench, which is precisely what a maintainer authorizes by applyinghwci-ok.hwci-oklabel. Only maintainers can label.ifskips before anything privileged happens.Testing after merge
Re-apply
hwci-okto fork PR #744 (rt-rtos's reverb-OOM fix) — it should dispatch, bench, and comment back. The label is already on, so remove + re-add to fire a fresh event.🤖 Generated with Claude Code