Repository navigation
ci: label pull requests from workflow_run instead of pull_request_target - #2778
Merged
Merged
Conversation
GitHub blocks the pull_request_target trigger by default on public repositories from December 2, 2026, and ASF infra is disabling it for ASF repositories. The Labeler workflow (dev_pr.yml) runs on that trigger. Split it in two: - dev_pr_trigger.yml runs on pull_request with no permissions and does nothing. Its completion starts the labeler. - dev_pr.yml runs on workflow_run from the default branch with pull-requests: write. It looks up the open pull requests whose head repository, branch and commit match the triggering run, and passes them to actions/labeler through its pr-number input. Nothing from the pull request is checked out or run, and no artifact is read. Closes apache#2773. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
andygrove
approved these changes
Nov 8, 2026
andygrove
left a comment
Member
There was a problem hiding this comment.
Thanks for picking this up, and for the thorough testing notes! The split matches what we did in Comet, and I like that the write job reads nothing from the run beyond the head repository, branch and commit. A few small suggestions, mostly borrowed from the Comet version:
- Could the job's
if:also checkgithub.repository == 'apache/datafusion-ballista'? Otherwise every fork with Actions enabled runs the labeler against its own pull requests. - The trigger only runs an
echo, soubuntu-latest(orubuntu-slim) would save a macOS runner on every push. macOS runners are the scarce ones in the ASF pool. The labeler job could move too. - Maybe add
timeout-minutes: 10on the labeling job.
None of these block, so approving. I'll keep an eye on the first pull request after this merges to make sure it gets labeled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #2773.
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. The Labeler workflow (.github/workflows/dev_pr.yml) runs on that trigger, so pull requests would stop getting their path labels. Upstream tracking issue: apache/datafusion#26406.What changes are included in this PR?
The labeler is split into two workflows, following the lookup that apache/datafusion#26683 and apache/datafusion-comet#7482 use:
dev_pr_trigger.yml(new,Labeler trigger) runs onpull_requestforopened,reopenedandsynchronize. It haspermissions: {}and does nothing. It exists only so that its completion can start the labeler.dev_pr.yml(Labeler) now runs onworkflow_runwhen the trigger completes.workflow_runalways runs the default branch's copy of the file, with a token that can write labels on fork pull requests. The job:actions/github-script.workflow_run.pull_requestsis empty for fork pull requests, so it can't be used. No artifact is read and nothing from the pull request is checked out or run. A commit that is no longer a head matches nothing, because the run for the newer push labels the pull request. If one branch has pull requests open against several bases, all of them are labeled.actions/labeler@v7.0.0through itspr-numberinput. The config file,sync-labels: trueand themacos-latestrunner stay the same. With no checkout, the labeler reads.github/workflows/dev_pr/labeler.ymlthrough the API at the default branch's commit.permissions: {}at the top level andcontents: readandpull-requests: writeon the job.workflow_rundoesn't carry the pull request number.I also removed the commented-out
actions-label-merge-conflictstep. It was written forpull_request_targetand wouldn't work as it is underworkflow_run.Behavior changes:
editedis no longer a trigger. The old labeling step already skipped it, so it only started a job that did nothing.reopenedis new.pull_requestworkflows while a pull request has merge conflicts. A conflicting pull request is labeled once the conflict is resolved.dev_pr_trigger.yml, so it can change or delete it. The only effect is that the pull request isn't labeled.dev_pr.ymlreads nothing from the run apart from its head repository, branch and commit.branch-53,branch-54andbranch-55still have thepull_request_targetversion ofdev_pr.yml. Backport pull requests won't be labeled once the trigger is blocked unlessdev_pr_trigger.ymlis backported too. The labeler onmainpicks up trigger runs from any branch. I left that for a follow-up.Are there any user-facing changes?
No. This only changes CI.
How are these changes tested?
workflow_runonly fires from the default branch's copy of a workflow, so this can't run end to end before it merges. What I checked:workflows: [Labeler trigger]matches the trigger'sname, and no other workflow uses that name.actions/github-scriptis owned byactions, which the ASF allowlist check trusts.github-scriptbody fromdev_pr.ymland ran it with Node against the real REST API, using the payloads of realpull_requestruns in this repository:NoahKusaba:perf/sort-shuffle-split-on-arrival-v2) and fix:ballista.planner.propagate_empty.enabledhas no effect:PropagateEmptyExecRulealways runs #2776 (milenkovicm:fix_2768), whose runs have an emptypull_requests, resolve to2774and27762777head_repository: null)actions/labelerv7.0.0 source.pr-numberis read withgetMultilineInput, and a config file that isn't on disk is fetched through the API atgithub.context.sha. Underworkflow_runthat is the latest commit on the default branch.After this merges, opening or pushing to a pull request should run
Labeler triggerand thenLabeler, and the pull request should get its labels.🤖 Generated with Claude Code