Skip to content

Commit fc5d2a3

Browse files
authored
ci: make integration test check blocking for fork PRs (#744)
## Summary - Fork PRs without the `ok-to-test` label currently show the integration test check as **skipped**, which GitHub treats as passing — making the PR look green when integration tests haven't run - Remove `&& github.event.pull_request.head.repo.full_name == github.repository` from the job-level `if`, so the job runs for all `pull_request` events (including forks) - For unapproved fork PRs, the existing "Check fork PR authorization" step fails immediately with `exit 1` before `actions/checkout`, making the check **blocking** instead of silently green - No security change: fork code is never checked out until after the label gate passes via `pull_request_target` ## Test plan - [ ] Fork PR without `ok-to-test` label → integration check shows as failed, not skipped - [ ] Fork PR with `ok-to-test` label added → `pull_request_target` fires, integration tests run normally - [ ] Internal PR (same repo) → integration tests run automatically as before
1 parent 2948293 commit fc5d2a3

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Under the Hood
2+
body: 'Make integration test check blocking for fork PRs: fail early instead of skipping when ok-to-test label is absent'
3+
time: 2026-04-28T10:42:20.688843+02:00

.github/workflows/integration-tests-pr.yaml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ name: Integration tests
44
# 1. Internal PRs (same repo): Runs automatically via pull_request trigger
55
# 2. Fork PRs: Requires 'ok-to-test' label added by maintainer (pull_request_target)
66
#
7-
# Fork PRs via pull_request are skipped (not failed) to avoid confusing status checks.
8-
# This protects secrets from being exfiltrated by malicious fork PRs.
7+
# Fork PRs via pull_request run but fail early (before checkout) until approved.
8+
# This makes the check blocking rather than showing as a green skip.
9+
# Secrets are not exposed to fork PRs until the ok-to-test gate passes.
910
on:
1011
pull_request:
1112
types: [opened, synchronize, reopened]
@@ -26,19 +27,21 @@ permissions:
2627

2728
jobs:
2829
integration:
29-
# Only run for:
30-
# 1. pull_request_target from fork PRs (with ok-to-test label)
31-
# 2. pull_request from internal PRs (not forks)
30+
# Run for:
31+
# 1. pull_request_target from fork PRs when the ok-to-test label is applied
32+
# 2. pull_request from any PR — fork PRs fail at the auth gate step before checkout
3233
if: |
33-
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) ||
34-
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
34+
(github.event_name == 'pull_request_target' &&
35+
github.event.pull_request.head.repo.full_name != github.repository &&
36+
github.event.label.name == 'ok-to-test') ||
37+
github.event_name == 'pull_request'
3538
runs-on: ubuntu-24.04
3639
environment: integration
3740
permissions:
3841
contents: read
3942
steps:
40-
# Gate: Block fork PRs that come through pull_request (no secrets, no label check)
41-
# This is a safety net - the job-level `if` should skip these, but this ensures they fail if reached
43+
# Gate: Block fork PRs that come through pull_request (no secrets, no label check).
44+
# Fork PRs intentionally reach this step and fail here until ok-to-test is added.
4245
- name: Check fork PR authorization
4346
if: |
4447
github.event_name == 'pull_request' &&

0 commit comments

Comments
 (0)