Skip to content

Commit 7dc5e39

Browse files
ci: let fork PRs enter the merge queue (skip e2e on forks, keep unit+coverage)
Fork PRs could not enter the merge queue. The required `coverage` check `needs: [unit-test, e2e-test]`, but `e2e-test` uses the azure-prod environment and warehouse secrets that GitHub withholds from a fork's pull_request run — so e2e-test can't pass on a fork, coverage is skipped, and the required coverage check never posts on the fork head, leaving the PR permanently BLOCKED. Skip e2e on fork PRs only; keep unit-test and coverage running everywhere: - e2e-test: `if: github.event.pull_request.head.repo.fork != true`. Runs on internal PRs, push, and merge_group (no fork context there); skipped on forks. A fork's code is still e2e-tested in the merge queue before it can merge. - coverage: `if: !cancelled() && needs.unit-test.result == 'success' && needs.e2e-test.result != 'failure'` so a SKIPPED e2e (forks) doesn't auto-skip coverage, while a genuine e2e FAILURE still blocks it (no regression). - codecov upload step: gated to non-forks (CODECOV_TOKEN is absent on forks and fail_ci_if_error would fail the required check); the report still generates from unit-test artifacts, only the external upload is skipped. Result: fork PRs run unit-test + coverage → coverage posts success → they can auto-enqueue; the real e2e suite runs in the merge queue. Co-authored-by: Isaac Signed-off-by: eric-wang-1990 <115501094+eric-wang-1990@users.noreply.github.com>
1 parent 6fdff86 commit 7dc5e39

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ jobs:
101101
retention-days: 1
102102

103103
e2e-test:
104+
# Skip on fork PRs only: e2e needs the azure-prod environment + warehouse
105+
# secrets, which GitHub withholds from a fork's pull_request run — so it
106+
# can't pass there and would otherwise permanently block the required
107+
# `coverage` check (which needs this job), keeping fork PRs out of the merge
108+
# queue. On internal PRs, push, and merge_group there is no
109+
# `pull_request.head.repo.fork == true`, so this runs normally — a fork PR's
110+
# code is still e2e-tested in the merge queue (base-repo context, secrets
111+
# available) before it can merge.
112+
if: ${{ github.event.pull_request.head.repo.fork != true }}
104113
runs-on:
105114
group: databricks-protected-runner-group
106115
labels: linux-ubuntu-latest
@@ -162,6 +171,12 @@ jobs:
162171

163172
coverage:
164173
needs: [unit-test, e2e-test]
174+
# Run whenever unit-test passed, tolerating a SKIPPED e2e-test (fork PRs,
175+
# where e2e is skipped above). A default `needs` would auto-skip coverage
176+
# when e2e is skipped, leaving this required check absent on fork heads and
177+
# blocking the merge queue. A genuine e2e FAILURE (internal PR / merge_group)
178+
# still blocks coverage — e2e stays enforced everywhere it can run.
179+
if: ${{ !cancelled() && needs.unit-test.result == 'success' && needs.e2e-test.result != 'failure' }}
165180
runs-on:
166181
group: databricks-protected-runner-group
167182
labels: linux-ubuntu-latest
@@ -188,7 +203,12 @@ jobs:
188203
ls -1 coverage_*.tar | xargs -I '{}' -- tar -xvf '{}'
189204
rm coverage_*.tar
190205
- run: ls -la
206+
# Upload to Codecov only when the token is available (non-fork). Forks
207+
# can't access CODECOV_TOKEN, and with fail_ci_if_error the step would
208+
# fail the required coverage check on forks. The report still generates
209+
# from the unit-test artifacts; only the external upload is skipped.
191210
- name: Coverage
211+
if: ${{ github.event.pull_request.head.repo.fork != true }}
192212
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3
193213
with:
194214
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)