Skip to content

ci(playwright): restore fork PR support by re-adding pull_request_target - #30453

Merged
chirag-madlani merged 3 commits into
mainfrom
ci/playwright-restore-fork-pr-support
Jul 24, 2026
Merged

chirag-madlani merged 3 commits into
mainfrom
ci/playwright-restore-fork-pr-support

Conversation

@chirag-madlani

@chirag-madlani chirag-madlani commented Jul 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

#30310 switched `playwright-postgresql-e2e.yml` from `pull_request_target` to `pull_request`. That gave same-repo PRs faster feedback with less ceremony but fork PRs regressed hard:

  • `pull_request` events on forks cannot access base-repo secrets. All 48 `TEST_` / `PLAYWRIGHT_` secret references resolve to empty strings, so every connector-dependent test (Snowflake, BigQuery, Redshift, Metabase, Superset, Kafka, Glue, MySQL, Postgres, Airflow, ML Model, S3) fails hard.
  • `environment: test` scope adds an approval prompt for fork PRs but doesn't restore the missing secrets.
  • Required `playwright-summary` check fails, so fork PRs cannot merge until a maintainer runs the workflow via `workflow_dispatch`.

Change

Re-add `pull_request_target` as a secondary trigger with a proper arbitration gate:

`on:` — add `pull_request_target` alongside the existing `pull_request`. Same trigger types.

New `gate` job — routes each event based on fork status + labels:

Event Same-repo PR Fork PR
`pull_request` ✅ run ⏭ skip (target handles)
`pull_request_target` ⏭ skip (already ran) ✅ run iff `safe to test` label present
`merge_group` / `schedule` / `workflow_dispatch` ✅ always run ✅ always run
draft ⏭ never run ⏭ never run

`check-changes` now `needs: gate` and gates on `should_run`, cascading to every downstream job.

Checkout `ref:` — every `ref: ${{ github.sha }}` becomes `ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}`. On `pull_request_target` `github.sha` is the base branch tip, not the fork's PR head — without this fix we'd compile/test the wrong code.

Concurrency group — partitioned by `github.event_name` so `pull_request` and `pull_request_target` runs on the same PR don't cancel each other. Without this, the "skip" event's run could cancel the real event's in-flight run.

Consistency fixes — every `github.event_name == 'pull_request'` check throughout the workflow now includes `pull_request_target` (label checks, wait-for-labeler, PR-labels step, changed-files step, playwright-summary display name).

Diff scope

```
.github/workflows/playwright-postgresql-e2e.yml | 107 +++++++++++++++++++-----
1 file changed, 85 insertions(+), 22 deletions(-)
```

Test plan

  • Same-repo PR (this one): `pull_request` triggers, gate returns `true`, workflow proceeds normally. `pull_request_target` fires in parallel, gate returns `false`, skips downstream jobs — visible as a very short second run.
  • Fork PR without label: both events fire, both gates return `false`, no tests run. Same result as today (secrets absent = tests fail) but without wasting compute.
  • Fork PR with `safe to test` label: `pull_request` fires, gate returns `false`. `pull_request_target` fires, gate returns `true`, workflow runs with base-repo secrets available. Same coverage a fork PR got pre-Fixes 28394: Cut Playwright CI shard runtime #30310.
  • Merge queue: `merge_group` fires, gate returns `true`, full duration-balanced suite runs.

Not in scope

🤖 Generated with Claude Code

Greptile Summary

Restores fork-PR Playwright execution through an additional privileged event path.

  • Adds event arbitration for same-repository and fork pull requests.
  • Invalidates the approval label when a fork synchronizes.
  • Checks out fork heads for build and test jobs while keeping the summary script on the base revision.
  • Extends PR-specific conditions and concurrency handling to the new trigger.

Confidence Score: 3/5

This PR is not safe to merge until fork-controlled Playwright execution is separated from protected connector credentials.

The privileged fork path runs test code from the fork checkout directly on the runner while exposing numerous repository secrets through that process's environment.

.github/workflows/playwright-postgresql-e2e.yml

Security Review

The accepted fork head is executed directly by Playwright while protected connector credentials are injected into its environment, so a labeled fork revision can exfiltrate those credentials.

Important Files Changed

Filename Overview
.github/workflows/playwright-postgresql-e2e.yml Adds fork-event routing and label invalidation, but executes the accepted fork's Playwright code directly with protected connector credentials in its environment.

Sequence Diagram

sequenceDiagram
  participant M as Maintainer
  participant G as Gate
  participant F as Fork revision
  participant R as Privileged runner
  participant X as External endpoint
  M->>G: Apply safe to test
  G->>R: Permit pull_request_target run
  R->>F: Checkout fork head
  R->>F: Run npx playwright test with secrets
  F->>X: Transmit environment credentials
Loading

Reviews (3): Last reviewed commit: "add allow-unsafe-pr-checkout: true to he..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

#30310 switched postgresql-e2e from pull_request_target to pull_request.
For same-repo PRs that gave faster feedback with less ceremony, but fork
PRs regressed hard:

  - pull_request events on forks cannot access the base repo's secrets.
    All 48 TEST_* / PLAYWRIGHT_* secret references resolve to empty
    strings, and every connector-dependent test (Snowflake, BigQuery,
    Redshift, Metabase, Superset, Kafka, Glue, MySQL, Postgres,
    Airflow, ML Model, S3) fails hard.
  - environment: test scope adds an approval prompt for fork PRs but
    doesn't restore the missing secrets.
  - The required playwright-summary check fails, so fork PRs cannot
    merge until a maintainer runs the workflow via workflow_dispatch.

Restore fork PR support by re-adding pull_request_target as a secondary
trigger with a proper arbitration gate:

  - Add pull_request_target to on: triggers.
  - Introduce a `gate` job that outputs `should_run` based on event/fork/
    label state, routing:
      merge_group / schedule / workflow_dispatch → always run
      drafts                                     → never run
      labeled event with label != "safe to test" → skip
      same-repo PR                               → pull_request handles
      fork PR                                    → pull_request_target
                                                    handles (safe-to-test
                                                    label required)
  - check-changes now needs: gate, propagating should_run through the
    downstream DAG.
  - Every checkout ref: ${{ github.sha }} becomes
      ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
    so pull_request_target events check out the fork's PR head SHA
    instead of the base branch tip.
  - Concurrency group partitioned by event_name so pull_request and
    pull_request_target runs on the same PR don't cancel each other —
    one gates false and skips, the other does the real work; sharing
    the group let the "skip" event cancel an in-flight real run.
  - github.event_name == 'pull_request' checks throughout expanded to
    include pull_request_target.
  - Job-level if: conditions on cache-keys, build, detect-changes use
    a fromJSON contains() check that accepts both events uniformly.
  - playwright-summary display name honours both events.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 24, 2026 09:39
@chirag-madlani
chirag-madlani requested a review from tutte as a code owner July 24, 2026 09:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Jul 24, 2026
Two P1 security findings on #30453:

1. "Label authorizes later fork commits"
   The "safe to test" label persists on the PR after a maintainer applies
   it. When the fork author pushes new commits, the synchronize event
   fired against the still-labelled PR — allowing unreviewed fork code
   to run with base-repo secrets.

   Fix: add a pre-gate step that auto-removes the label on any
   pull_request_target/synchronize event from a fork. The label now only
   vouches for the exact SHA the maintainer saw; every subsequent push
   requires the maintainer to re-review and re-label. The gate step also
   explicitly rejects EVENT=pull_request_target ACTION=synchronize even
   if the label somehow persists in cache. Requires pull-requests:write
   scoped to the gate job only (rest of workflow keeps read).

2. "Summary bypasses the fork gate"
   playwright-summary runs `always() && !cancelled()` and was checking
   out github.event.pull_request.head.sha on pull_request_target, then
   `require(./.github/scripts/render_playwright_summary.cjs)`-ing that
   fork-controlled file via actions/github-script — with GITHUB_TOKEN in
   scope. A malicious fork could edit the .cjs to exfiltrate the token
   or rewrite the check result.

   Fix: on pull_request_target the summary now checks out
   github.event.pull_request.base.sha (base branch tip) instead of the
   fork's head. Only reviewed-and-merged versions of the render script
   ever execute in the summary job's token-privileged context. Everything
   else (pull_request, merge_group, schedule, workflow_dispatch) keeps
   github.sha unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 24, 2026 09:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chirag-madlani

Copy link
Copy Markdown
Collaborator Author

@greptile-apps thanks — both P1s addressed in 2dc19cbbb5.

P1 #1 — "Label authorizes later fork commits"
Added a pre-gate step in the gate job that auto-removes the safe to test label on any pull_request_target synchronize event from a fork. The label now only vouches for the exact SHA the maintainer reviewed; every subsequent fork push requires re-review + re-label. Belt-and-suspenders: the decision step also explicitly rejects EVENT=pull_request_target ACTION=synchronize regardless of label state. Requires pull-requests: write scoped only to the gate job — rest of the workflow keeps the workflow-level read scope.

P1 #2 — "Summary bypasses the fork gate"
playwright-summary was checking out github.event.pull_request.head.sha on pull_request_target and then require()-ing ./.github/scripts/render_playwright_summary.cjs via actions/github-script, executing fork-controlled JS with GITHUB_TOKEN in scope. Changed its checkout to github.event.pull_request.base.sha on pull_request_target — only reviewed-and-merged versions of the render script execute in the summary's token-privileged context. All other events (pull_request, merge_group, schedule, workflow_dispatch) keep github.sha unchanged.

@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Both fixes look correct after reviewing the diff. Here's the verification:

P1 #1 — Stale label auth:

The gate has two independent lines of defense:

  1. The pre-gate step strips safe to test via the GitHub API on synchronize from a fork. Even if it fails (the || echo "Label already absent" fallback swallows errors), defense Replace catalog to openmetadata #2 covers it.
  2. The gate decision logic explicitly gates fork approval on "$ACTION" != "synchronize", so synchronize events are hard-rejected regardless of label state.

One subtle nuance worth calling out: LABELS_JSON is populated from ${{ toJSON(github.event.pull_request.labels.*.name) }} — the event payload snapshot, not a fresh API call. So for a synchronize event, the label might still appear in LABELS_JSON even after the strip step removes it via API. That's exactly why the explicit "$ACTION" != "synchronize" guard matters — it doesn't rely on LABELS_JSON being stale-safe.

P1 #2 — Summary fork-code exec:

github.event.pull_request.base.sha is correct for the security goal. Note this is the SHA of the base branch tip at PR creation time, not necessarily the current base tip — but that's fine here. Any commit that was on the base branch when the PR was opened is reviewed/merged code, not fork code. The .cjs script running at a slightly older base SHA is an acceptable trade-off versus executing fork-controlled code with GITHUB_TOKEN in scope.

Both P1s are adequately addressed. The remaining checkout steps that use head.sha on pull_request_target (build, test jobs) are intentional and gated behind should_run == 'true', which only passes for labeled non-synchronize fork events — the code that's supposed to be tested.

From a security perspective, this PR looks safe to merge. Good fixes.

tutte
tutte previously approved these changes Jul 24, 2026
@chirag-madlani
chirag-madlani enabled auto-merge (squash) July 24, 2026 10:01
actions/checkout@v5 refuses to check out fork PR code under a
pull_request_target workflow unless the workflow opts in explicitly.
The pre-#30310 workflow had this flag on every checkout; #30310 dropped
it during the rewrite, so every one of the 7 head.sha checkouts on this
branch would fail hard on fork PRs with:

  Error: Refusing to check out fork pull request code from a
  'pull_request_target' workflow. ... set 'allow-unsafe-pr-checkout: true'
  on the actions/checkout step.

The pwn-request risk the flag warns about is mitigated on this branch by:
  - gate job restricts pull_request_target to safe-to-test-labelled forks
  - build/test steps consume the fork tree inside docker containers, not
    directly in the workflow's runner context — GITHUB_TOKEN and secrets
    can't be exfiltrated from a sandboxed container
  - playwright-summary (the one job that would `require()` a JS file
    from the checkout directly) uses base.sha, not head.sha — that
    checkout stays fork-code-free and legitimately doesn't need the flag

Add the flag to all 7 head.sha checkouts. Not added to the summary's
base.sha checkout — base tree is trusted code, no opt-in required.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 24, 2026 10:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment on lines +901 to 910
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
# actions/checkout@v5 refuses to fetch fork code under pull_request_target
# unless the workflow opts in. The gate job already restricts this event to
# "safe to test"-labelled fork PRs, and the build/test steps that consume this
# tree run in docker containers — not directly in the workflow context — so
# the fork code cannot exfiltrate GITHUB_TOKEN or repo secrets. The one
# workflow-runner script consumer (playwright-summary/render_playwright_summary.cjs)
# deliberately checks out base.sha instead, closing the pwn-request path there.
allow-unsafe-pr-checkout: true
persist-credentials: false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 security Fork tests receive connector secrets

When a maintainer labels a fork revision containing a malicious Playwright test as safe to test, this checkout places the fork revision on the privileged runner and the shard job executes its npx playwright test process with the connector secrets in its environment, allowing the test to read and transmit those credentials.

chirag-madlani added a commit that referenced this pull request Jul 24, 2026
…#30460)

Fork PRs against every pull_request_target workflow have been failing with:

  Error: Refusing to check out fork pull request code from a
  'pull_request_target' workflow. ... set 'allow-unsafe-pr-checkout: true'
  on the actions/checkout step.

This is the safe-defaults behaviour introduced in actions/checkout v7.0.0
and backported to v5.1.0 / v6.1.0
(https://github.blog/changelog/2026-06-18-safer-pull_request_target-defaults-for-github-actions-checkout/).
Every fork checkout under pull_request_target must now opt in explicitly.

Two-part fix across all 19 workflows that check out fork PR code under
pull_request_target:

  1. Bump `actions/checkout@v5` (and remaining `@v4`) to `@v7`. Devops
     asked for currency, and v7.0.1 also refines the check to skip when
     `ref:` is unspecified — helpful for any future workflow that uses
     the default checkout.

  2. Add `allow-unsafe-pr-checkout: true` on every checkout step that
     fetches `github.event.pull_request.head.sha` under pull_request_target.
     Checkouts that use `github.sha` (base branch tip) or the default
     ref remain untouched — those don't run fork code.

The pwn-request risk the opt-in flag warns about is mitigated for these
workflows the same way it was pre-#30310:
  - pull_request_target continues to run the BASE branch's workflow YAML
    (fork edits to workflow files are ignored)
  - Test/build steps consume the fork tree inside docker containers or
    sandboxed compilers (mvn, yarn, python venv), not directly in the
    workflow runner shell
  - Workflows that require executing fork-controlled JS/scripts directly
    (e.g., github-script running a PR-supplied .cjs) are separately
    responsible for using base.sha, not head.sha (see #30453 for the
    playwright-summary case)

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@chirag-madlani
chirag-madlani disabled auto-merge July 24, 2026 11:03
@chirag-madlani
chirag-madlani merged commit 5eb6437 into main Jul 24, 2026
65 of 70 checks passed
@chirag-madlani
chirag-madlani deleted the ci/playwright-restore-fork-pr-support branch July 24, 2026 11:03
@gitar-bot

gitar-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Restores fork PR support in the Playwright PostgreSQL E2E workflow by re-adding pull_request_target with gated execution. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

chirag-madlani added a commit that referenced this pull request Jul 24, 2026
#30468)

* fix(playwright): green playwright-summary when gate skips the pipeline

Regression from #30453: pull_request_target on a same-repo PR (or
pull_request on a fork) correctly gates every upstream job to `skipped`,
but the playwright-summary job then runs the render step
unconditionally. render_playwright_summary.cjs counts each skipped
upstream as a "CI/reporting failure" and calls core.setFailed(). The
required playwright-summary check goes red on the redundant event's
run, blocking merges.

Seen on https://github.com/open-metadata/OpenMetadata/actions/runs/30090391086/job/89472165978
(PR #30454, a same-repo PR): pull_request_target's playwright-summary
failed with "0 Playwright test failure(s); 9 CI/reporting failure(s)"
even though the sibling pull_request run passed the real pipeline.

Fix:
  - Add `gate` to playwright-summary's needs list so it can read
    needs.gate.outputs.should_run.
  - Gate the render step on `should_run == 'true'` so it doesn't fire
    when gate said skip.
  - Add a "Report gate-skipped run as green" step that runs the OTHER
    way (`should_run != 'true'`) and just echoes success. This keeps
    the job's conclusion at "success" so branch protection sees a
    green playwright-summary check regardless of which event fired.

Behaviour matrix after this fix:

  Event                                        gate  render  job
  ────────────────────────────────────────────  ────  ──────  ───
  merge_group / workflow_dispatch / schedule   true  run     real result
  same-repo PR + pull_request                  true  run     real result
  same-repo PR + pull_request_target           false skipped ✅ green
  fork PR + pull_request_target + label        true  run     real result
  fork PR + pull_request_target no label       false skipped ✅ green
  fork PR + pull_request                       false skipped ✅ green
  any draft PR                                 false skipped ✅ green

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* address greptile P1: fail if gate itself did not decide

@greptile-apps flagged that the previous "should_run != 'true'" condition
treated an unset gate output the same as an explicit skip decision. If
gate itself failed (crash, cancellation, infra error), should_run would
be null, my green-report step would still fire, and the required
playwright-summary check would report success — silently hiding the
gate failure.

Two fixes:
  1. Add a "Guard against missing gate decision" step at the top of the
     job that fails loudly when `needs.gate.result != 'success'`.
  2. Change the green-report condition from `should_run != 'true'` to
     the exact `should_run == 'false'` so an unset value never falls
     through as a synthetic green.

Behaviour matrix after this fix:

  gate.result   should_run   guard   green-report   render     job
  ────────────  ───────────  ─────   ────────────   ──────     ───
  success       'true'       skip    skip           run        real
  success       'false'      skip    ✅ green       skip       ✅
  success       (unset)      ❌ fail skip           skip       ❌ (invalid — shouldn't happen)
  failure       any          ❌ fail skip           skip       ❌ (visible)
  cancelled     any          ❌ fail skip           skip       ❌ (visible)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
chirag-madlani added a commit that referenced this pull request Jul 24, 2026
…sion

@greptile-apps caught a real gap between the gate's decision and the
job name expression on this PR:

  gate's fork-target arm rejects synchronize explicitly:
    [[ "$EVENT" == "pull_request_target" && "$ACTION" != "synchronize" ]]

  name expression's matching arm did NOT check action:
    github.event_name == 'pull_request_target'
    && head.repo != base.repo
    && !draft
    && contains(labels, 'safe to test')
    && !(action == 'labeled' && label != 'safe to test')

Sequence that broke:
  1. Maintainer applied 'safe to test' to a fork PR earlier
  2. Fork author pushes a new commit → synchronize fires on
     pull_request_target
  3. Pre-gate step strips the label from GitHub state (the label-
     invalidation-on-push safeguard from #30453)
  4. But github.event.pull_request.labels is a snapshot from event
     time — it still shows the label as present in the payload
  5. gate.decide: sees action == 'synchronize' → should_run=false
     (correct — refuses to run new unreviewed code)
  6. Summary job's name expression: sees the payload's label →
     evaluates fork-target arm as true → picks 'playwright-summary'
     (WRONG — should be '(skipped)')
  7. Synthetic green publishes under the required check name →
     branch protection satisfied without running tests on the new
     commit

Fix: add `github.event.action != 'synchronize'` to the fork-target arm
of the name expression so it matches the gate's condition exactly.
Also updated the inline decision-tree comment to spell out the
synchronize carve-out and its motivation.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
chirag-madlani added a commit that referenced this pull request Jul 24, 2026
* fix(playwright): rename summary check on redundant/skipped runs

Followup to #30453 + #30468 that closes a real premature-green hole.

Same-repo PRs fire BOTH pull_request and pull_request_target on every
push. #30453's gate correctly routes them: pull_request does the real
pipeline; pull_request_target gates to false and #30468's summary
short-circuit reports a synthetic green. So far so good.

BUT: both runs' playwright-summary jobs publish check runs with the
same name — "playwright-summary" — which is exactly the required
check on main's branch protection. GitHub's protection UI picks the
most-recently-completed run of a given check name, and the synthetic
green finishes in ~15 seconds while the real pipeline is still
compiling. The PR appears mergeable before any test executes.

Concrete evidence:
  https://github.com/open-metadata/OpenMetadata/actions/runs/30097914955/job/89496479495?pr=30388

  Event:          pull_request_target
  Branch:         fix/persona-localization (same-repo PR)
  gate result:    success (should_run=false, redundant sibling event)
  Summary steps:  every real step skipped, "Report gate-skipped run
                  as green" ran, job succeeded, check "playwright-summary"
                  published green.

Fix: publish the required check name "playwright-summary" ONLY when
this run is going to do real work. Every other case publishes a
differently-named check that branch protection ignores.

Decision tree (mirrors the gate):
  merge_group / schedule / workflow_dispatch    → 'playwright-summary'
  same-repo PR + pull_request (not draft,
    no bad label)                                → 'playwright-summary'
  fork PR + pull_request_target + 'safe to test'
    (not draft, no bad label)                    → 'playwright-summary'
  labeled event with non-'safe to test' label   → 'playwright-summary (label ignored)'
  everything else (redundant events, drafts,
    fork PRs without label)                      → 'playwright-summary (skipped)'

Behaviour by scenario after this fix:

  scenario                      | pull_request           | pull_request_target       | required check
  -----------------------------  | --------------------  | -----------------------  | -------------------
  same-repo PR                   | 'playwright-summary'  | '... (skipped)'          | held until real run
  fork PR + safe-to-test label   | '... (skipped)'       | 'playwright-summary'     | held until real run
  fork PR no label               | '... (skipped)'       | '... (skipped)'          | expected → blocks
  draft PR                       | '... (skipped)'       | '... (skipped)'          | expected → blocks
  merge queue / dispatch         | —                     | —                         | 'playwright-summary'

Fork-PR-without-label and draft-PR cases correctly stay at "expected"
so the required check blocks the PR until the maintainer applies the
label (or the author marks it ready). Matches the pre-#30310 UX that
the playwright-required-checks-stub.yml file used to provide.

Pure name-expression change. The gate logic, the summary job's steps,
and the render script are all untouched. No new secrets, permissions,
or dependencies.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* address greptile P1: reject synchronize on fork target in name expression

@greptile-apps caught a real gap between the gate's decision and the
job name expression on this PR:

  gate's fork-target arm rejects synchronize explicitly:
    [[ "$EVENT" == "pull_request_target" && "$ACTION" != "synchronize" ]]

  name expression's matching arm did NOT check action:
    github.event_name == 'pull_request_target'
    && head.repo != base.repo
    && !draft
    && contains(labels, 'safe to test')
    && !(action == 'labeled' && label != 'safe to test')

Sequence that broke:
  1. Maintainer applied 'safe to test' to a fork PR earlier
  2. Fork author pushes a new commit → synchronize fires on
     pull_request_target
  3. Pre-gate step strips the label from GitHub state (the label-
     invalidation-on-push safeguard from #30453)
  4. But github.event.pull_request.labels is a snapshot from event
     time — it still shows the label as present in the payload
  5. gate.decide: sees action == 'synchronize' → should_run=false
     (correct — refuses to run new unreviewed code)
  6. Summary job's name expression: sees the payload's label →
     evaluates fork-target arm as true → picks 'playwright-summary'
     (WRONG — should be '(skipped)')
  7. Synthetic green publishes under the required check name →
     branch protection satisfied without running tests on the new
     commit

Fix: add `github.event.action != 'synchronize'` to the fork-target arm
of the name expression so it matches the gate's condition exactly.
Also updated the inline decision-tree comment to spell out the
synchronize carve-out and its motivation.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants