diff --git a/.github/workflows/e2e-fork.yaml b/.github/workflows/e2e-fork.yaml index 56d633bb6..ab082aa98 100644 --- a/.github/workflows/e2e-fork.yaml +++ b/.github/workflows/e2e-fork.yaml @@ -108,6 +108,27 @@ jobs: core.setOutput('should_run', 'false'); }; + // Discarded label event: pull-requests.yaml triggers on `labeled` but + // its `plan` guard discards every label other than full-e2e, so such a + // run skips every job and builds nothing. Post NOTHING and stop — + // deciding here would overwrite an already-green status with red (via + // the CONCLUSION check or the missing-pr-patch check below) every time + // anyone labels an open fork PR. Fail-closed: statuses are per-SHA and + // an unposted required status stays "Expected", which blocks the merge, + // so declining to post can only ever preserve a verdict a real run + // reached — never invent one. A fork editing the workflow to force this + // path just leaves its head SHA with no status, i.e. not mergeable. + const jobs = await github.paginate( + github.rest.actions.listJobsForWorkflowRun, + { owner, repo, run_id: RUN_ID, per_page: 100 }, + ); + const plan = jobs.find(j => j.name === 'Plan build'); + if (plan && plan.conclusion === 'skipped') { + console.log(`Triggering run ${RUN_ID} skipped 'Plan build' (discarded label event) — leaving "E2E Tests" untouched.`); + core.setOutput('should_run', 'false'); + return; + } + // Fork build did not succeed → fail the required status (fail-closed). if (CONCLUSION !== 'success') { await decide('failure', `Pull Request workflow concluded '${CONCLUSION}'; e2e not run`);