Repository navigation
ci: label pull requests from workflow_run instead of pull_request_target - #7482
Conversation
GitHub blocks pull_request_target on public repositories from December 2, 2026, and ASF is disabling it. A no-op pull_request workflow now starts the labeler, which runs on workflow_run from the default branch, finds the pull request from the run's head repository, branch and commit, and applies the type and path labels through the API.
manuzhang
left a comment
There was a problem hiding this comment.
LGTM. Do we need back-port to branch-1.1 as well?
comphead
left a comment
There was a problem hiding this comment.
Thanks @andygrove. The privileged job reads nothing the PR's run produced, and only an API-derived PR number reaches with:, so the security model looks right to me. On @manuzhang's question: upstream/branch-1.1 also still has label_prs.yml on pull_request_target, so it needs the same backport as branch-1.2.
| pull_request_target: | ||
| types: [opened, synchronize, reopened] | ||
| workflow_run: | ||
| workflows: [Label pull requests trigger] |
There was a problem hiding this comment.
Nothing checks that this entry stays equal to the name: of label_prs_trigger.yml. If either is renamed, labeling stops without a failing check. dev/ci/check-ci-config.py already guards the same pairing for the fork bridge (BRIDGE_WORKFLOW against the name of ci.yml, plus the repository guard). Could it cover this pair too?
| # when it completes, label_prs.yml runs from the default branch through workflow_run and writes | ||
| # the labels. Kept separate from Comet CI so labels arrive in seconds rather than after CI. | ||
| on: | ||
| pull_request: |
There was a problem hiding this comment.
The events reference says pull_request workflows do not run while the PR has a merge conflict, and pull_request_target ones do. A PR opened with a conflict now gets no labels until a push after the conflict is resolved. Could this go in the list of behavior changes, or be covered by a schedule sweep like the one in fork_ci_status.yml?
Which issue does this PR close?
Closes #7475.
Rationale for this change
GitHub blocks the
pull_request_targettrigger by default on public repositories from December 2, 2026, with brownouts before then, and ASF infra is disabling it for ASF repositories.label_prs.ymlruns 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 onpull_requestforopened,synchronizeandreopened, the same events as before. It haspermissions: {}and does nothing. It exists only so its completion can start the labeler.label_prs.ymlnow runs onworkflow_runwhen the trigger workflow completes.workflow_runalways runs the default branch's copy of the file with the repository token, so it can write labels on fork pull requests. It:dev/ci/pr-type-label.mjs, read from the default branch checkout. Dependabot PRs are still skipped.actions/labeler@v7, passing the PR through itspr-numberinput.workflow_rundoesn'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.mdis updated to match.Behavior changes:
maininstead of from their base branch.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.2still runslabel_prs.ymlonpull_request_target. After this merges, it needs a backport that addslabel_prs_trigger.ymlthere and removes itslabel_prs.yml. Apull_requestrun uses the workflow files from the PR's base branch, but the labeler onmainpicks up the trigger run from any branch.How are these changes tested?
python3 dev/ci/check-ci-config.pyandactionlintpass on both workflows.node --test dev/ci/pr-type-label.test.mjsstill passes. The title logic is unchanged.GET /pulls?state=open&head=<owner>:<branch>returns docs: apply the style guide's "native" rules to timezones.md #7477 with the expected head SHA and repository.workflow_runonly 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 startLabel pull requests triggerand thenLabel pull requests, and the PR should get its labels.