Skip to content

fix(playwright-ci): verify safe-to-test label on fork PRs via API check [2.0] - #36136

Merged
TeddyCr merged 2 commits into
open-metadata:2.0from
TeddyCr:ci/fix-fork-label-verification-2.0
Oct 23, 2026
Merged

TeddyCr merged 2 commits into
open-metadata:2.0from
TeddyCr:ci/fix-fork-label-verification-2.0

Conversation

@TeddyCr

@TeddyCr TeddyCr commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Context

PR CI fails for any PR coming from a fork targeting a release branch (observed on a fork PR targeting 2.0, run 39987235690). The build job of playwright-postgresql-e2e.yml verifies the safe to test label with jesusvasquez333/verify-pr-label-action@v1.4.0, which hard-fails on every cross-repository PR under the pull_request event:

ERROR: PRs from forks are only supported when trigger on "pull_request_target"

This comes from the action's own guard (verify_pr_lables.py, v1.4.0):

# Check if the PR comes from a fork. If so, the trigger must be
# 'pull_request_target'. Otherwise exit on error here.
if pr.head.repo.full_name != pr.base.repo.full_name:
    if github_event_name != 'pull_request_target':
        sys.exit(1)

It is independent of the base branch and of the labels already on the PR — so on release branches (no merge queue, CI must run on the PR event) a fork PR can never pass, even after a maintainer applies safe to test. main is unaffected but only by accident: after #34740 its PR-triggered Playwright runs skip everything, so the fork path is never exercised there. Release branches (2.0, 1.13) still carry the PR-gated workflow.

Why the action can't just be run under pull_request_target

The workflow deliberately runs unprivileged on pull_request (it builds and caches PR code); switching to pull_request_target would run fork code with base-branch workflow context, which this repo explicitly avoids.

Change

Keep the action for same-repo PRs, and for fork PRs check the same label with a read-only gh api call — same gate, same labeled-event re-trigger:

- name: Verify PR labels
  if: ${{ ... head.repo.full_name == github.repository }}
  uses: jesusvasquez333/verify-pr-label-action@v1.4.0
  ...

- name: Verify safe-to-test label (fork PRs)
  if: ${{ ... head.repo.full_name != github.repository }}
  run: gh api "/repos/${REPO}/issues/${PR_NUMBER}/labels" --jq '.[].name' | grep -Fxq 'safe to test'

No extra workflow scope is needed: for pull requests, GET /repos/{repo}/issues/{n}/labels accepts either the Issues or the Pull requests repo permission (read) per the REST docs ("List labels for an issue"), so the existing pull-requests: read covers it.

  • Same-repo PRs: behavior unchanged.
  • Fork PRs without the label: fail at this step with an explicit "maintainer must add safe to test" message instead of the third-party refusal.
  • Fork PRs with the label: CI runs as expected.
  • main: untouched (no dispatcher change).

The same gate exists in the 1.13 release-branch copy of this workflow; happy to port the fix if maintainers prefer it applied there too.

Testing

  • YAML parse validated locally; actionlint not available locally.
  • Expected CI behavior on this very PR (a fork PR, whose merge ref contains the fix): build now waits at the fork label check until safe to test is applied, instead of erroring out with the action's fork message.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

Fork PRs now check the safe to test label through gh api. Same-repository PRs keep the existing action.

  • Fork pull requests can pass the Playwright label check when they are marked safe to test.

Reviews (2) · Last reviewed commit: "fix(playwright-ci): drop unneeded issues..." · Reviewed by Greptile

verify-pr-label-action v1.4.0 hard-fails on pull_request events for any
cross-repository PR (`ERROR: PRs from forks are only supported when
trigger on pull_request_target`), so fork PRs targeting release branches
could never pass the safe-to-test gate. main is unaffected because its
PR-triggered runs skip via the merge-queue dispatcher; 2.0 has no merge
queue and must run CI on the PR event.

Keep the action for same-repo PRs and check the label with a read-only
gh api call for fork PRs, preserving the safe-to-test gate for both.
Adds the minimal issues:read scope needed to list labels.
@TeddyCr
TeddyCr requested review from a team, akash-jain-10, harshach and tutte as code owners October 23, 2026 18:53
@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 Ingestion safe to test Add this label to run secure Github workflows on PRs labels Oct 23, 2026
@gitar-bot

gitar-bot Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · The fork-PR label check controls whether untrusted code runs in CI; a misapplied label could authorize unintended workflow execution.

Replaces the failing verify-pr-label-action step for fork PRs with a read-only gh api check for the safe to test label, so fork PRs targeting release branches can pass CI once a maintainer applies the label. Same-repo PRs keep the existing action. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

For pull requests, GET /repos/{repo}/issues/{n}/labels accepts either
the Issues or the Pull requests repo permission (read) per the REST
docs, so the existing pull-requests: read covers the fork-PR label
check. Reading labels from PRs does not require the issues scope.
@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs and removed safe to test Add this label to run secure Github workflows on PRs labels Oct 23, 2026
@TeddyCr
TeddyCr enabled auto-merge (squash) October 23, 2026 18:58

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

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants