← Back to Pull requests

ci: label pull requests from workflow_run instead of pull_request_target #7482

Open
unknown opened this pull request with 385 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 04, 2026 13:36 UTC
Author

Which issue does this PR close?

Closes #7475.

Rationale for this change

GitHub blocks the pull_request_target trigger by default on public repositories from December 2, 2026, with brownouts before then, and ASF infra is disabling it for ASF repositories. label_prs.yml runs on that trigger, so pull requests would stop getting their type and path labels. Upstream tracking issue: apache/datafusion#26406.

What changes are included in this PR?

The labeler is split into two workflows:

  • label_prs_trigger.yml (new) runs on pull_request for opened, synchronize and reopened, the same events as before. It has permissions: {} and does nothing. It exists only so its completion can start the labeler.

  • label_prs.yml now runs on workflow_run when the trigger workflow completes. workflow_run always runs the default branch's copy of the file with the repository token, so it can write labels on fork pull requests. It:

  • - finds the open pull request whose head repository, branch and commit match the triggering run. Nothing produced by the PR's run is read, so there is no artifact to trust. If the head has moved on, the run for the newer push labels the PR instead.
    - applies the type label from the title with the existing dev/ci/pr-type-label.mjs, read from the default branch checkout. Dependabot PRs are still skipped.
    - applies the path labels with actions/labeler@v7, passing the PR through its pr-number input.
    - keeps the per-PR concurrency group with cancellation, now keyed on the head repository and branch because workflow_run doesn't carry the PR number. It also adds a repository guard so the workflow doesn't run in forks.

    The standalone workflow table in .github/workflows/README.md is updated to match.

    Behavior changes:

  • PRs targeting a release branch now get type and path rules from main instead of from their base branch.

  • Under pull_request, a first-time contributor's trigger run may wait for maintainer approval, depending on the repository's Actions settings. Their PR may not be labelled until a maintainer approves the run.
  • branch-1.2 still runs label_prs.yml on pull_request_target. After this merges, it needs a backport that adds label_prs_trigger.yml there and removes its label_prs.yml. A pull_request run uses the workflow files from the PR's base branch, but the labeler on main picks up the trigger run from any branch.

    How are these changes tested?

  • python3 dev/ci/check-ci-config.py and actionlint pass on both workflows.

  • node --test dev/ci/pr-type-label.test.mjs still passes. The title logic is unchanged.

  • I checked the PR lookup with the same REST call on an open fork PR: GET /pulls?state=open&head=<owner>:<branch> returns #7477 with the expected head SHA and repository.

  • workflow_run only fires from the default branch's copy of a workflow, so this can't be tested end to end until it merges. After merge, opening or pushing to any PR should start Label pull requests trigger and then Label pull requests, and the PR should get its labels.
  • Diff: 385 lines (+288 / -97) across 4 files Reviewer: comphead Review duration: 609m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.43) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 385 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.356
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #7482"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43% (MEDIUM) · Higher = larger blast radius
    43%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.9% · Safe to merge
    22.9%