fix(ci): run e2e-local on labeled fork PRs via pull_request_target - #987
Conversation
Fork-PR `pull_request` runs get no secrets and no repository variables,
so a maintainer-labeled fork PR passed the label gate and crashed in
start-runner ("Input required and not supplied: app-id", run
29324915498). Switch the PR trigger to `pull_request_target` so labeled
PRs run with base-repo credentials, hardened for untrusted code:
- fork approval is per-push: only the `e2e-local` labeling event runs a
fork PR, pinned to the labeled head SHA; new pushes need a re-label
(same-repo PRs keep re-running on every push while labeled)
- checkout pins github.event.pull_request.head.sha (pull_request_target
resolves to the base branch by default) with persist-credentials off
- top-level `permissions: contents: read` keeps the default token
read-only in e2e-tests; gate inputs move from inline ${{ }} to env
Claude-Session: https://claude.ai/code/session_01HkVMvjNbCKPrbwxps95jTp
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe e2e-local workflow now uses Changese2e-local fork gating
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant GitHub
participant should-run
participant e2e-tests
GitHub->>should-run: labeled or synchronize pull_request_target event
should-run->>should-run: inspect e2e-local label and event action
should-run->>e2e-tests: enable run for permitted labeled commit
e2e-tests->>e2e-tests: checkout pull request head SHA
Possibly related PRs
Suggested labels: ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
tester seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
📦 BoxLite review — looks good ·
|
Summary
Run 29324915498 failed on fork PR #982: GitHub withholds secrets and repository variables from fork
pull_requestruns (Secret source: None), so the maintainer-appliede2e-locallabel sent the run intostart-runner, wherecreate-github-app-tokenfailed with "Input required and not supplied: app-id". The label contract ("label ⇒ e2e runs") was implemented on an event type that structurally cannot honor it for forks.Switch the PR trigger to label-gated
pull_request_target(base context: credentials available, workflow definition always frommain), hardened per the standard pattern (protobuftest_runner.yml, GitHub security-hardening guidance):e2e-locallabeling event, pinned to the labeled head SHA; pushes after approval are skipped with a notice until a maintainer re-labels. Same-repo PRs keep today's behavior (re-run on every push while labeled).head.sha—pull_request_targetresolves to the base branch by default, which would silently testmain;persist-credentials: falseso no token remains on the persistent runner when fork code runs.permissions: contents: read(thepull_request_targetdefault is write-capable);should-rungate inputs move from inline${{ }}interpolation intoenv:.Blast radius of an approved-then-malicious fork run stays contained: secrets exist only in
start-runner/stop-runner(GitHub-hosted, never execute PR code), and the runner's instance profile allows only self-termination (scripts/ci/setup-ci-runner.sh).Verification
actionlint: identical 2 pre-existing findings as HEAD's version — zero new findingsshould-runscript extracted from the YAML and executed across 9 event scenarios passes 9/9 (push/dispatch run; same-repo labeled runs on label+synchronize; fork runs only on thee2e-locallabeling event; stale/unapproved fork events skip)pull_request, fork,e2e-localpresent), returnsrun=true— the path into the credential-less crashAfter merge: remove and re-add
e2e-localon #982 to run e2e against its current head.https://claude.ai/code/session_01HkVMvjNbCKPrbwxps95jTp
Summary by CodeRabbit
CI Improvements
e2e-locallabel is applied, using the labeled commit.Documentation