Skip to content

CI: migrate the dialect labeler away from pull_request_target - #2891

Open
ump45nose wants to merge 2 commits into
apache:mainfrom
ump45nose:ci-migrate-dialect-labeler
Open

ump45nose wants to merge 2 commits into
apache:mainfrom
ump45nose:ci-migrate-dialect-labeler

Conversation

@ump45nose

Copy link
Copy Markdown

Dialects: none

What

Migrates the dialect labeler off pull_request_target, which ASF infra is disabling and GitHub will block by default on 2 December 2026.

  • Add a permissionless pull_request signal workflow (opened / edited / reopened / synchronize).
  • Run the existing dialect labeler from the default branch on that workflow's workflow_run requested event.
  • Look up the current open pull request(s) for the signal's head repository and branch instead of trusting pull request code or an artifact.
  • Leave the issues and issue_comment paths unchanged.

edited is included so a title or Dialects: line update still applies labels, matching the current behavior. The requested event fires even while a first-time contributor's checks wait for approval.

This follows the current approach in apache/datafusion#26683 rather than uploading a pull request number artifact: that pull request moved to a signal plus an API lookup, which avoids treating PR-produced data as input.

The new pull request path takes effect after this change is on the default branch. Until then, the existing pull_request_target workflow on main continues to label pull requests.

Fixes #2818

Tests

  • node --check on both labeler scripts
  • Mocked Node checks for: labeling from an explicit pull object, the unanswered-PR prompt, the unchanged issue_comment path, and pull_requests_of_run.js
  • No Rust changes, so cargo test / fmt / clippy were not rerun

AI assistance

Prepared with AI assistance. I reviewed the workflow change, the script updates, and the referenced DataFusion pattern before opening this PR.

Fixes apache#2818

Signed-off-by: Vincent <ump45nose@users.noreply.github.com>
Comment thread .github/workflows/labeler.yml Outdated
# `issues` and `issue_comment` already run from the default branch and are
# unchanged.
concurrency:
group: ${{ github.repository }}-${{ github.event.workflow_run.head_repository.full_name || github.event.issue.number }}-${{ github.event.workflow_run.head_branch || github.event_name }}-${{ github.workflow }}

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.

You should give every issues and issue_comment run its own group.

As written, all comments on one pull request share <repo>-<number>-issue_comment-labeler, so with cancel-in-progress: true a second comment arriving while the first run is still working cancels it, and the dialects the first comment declared are never added.

main has no concurrency block, so this drops labels that are applied today, contrary to the "unchanged" comment above it.

Suggested change
group: ${{ github.repository }}-${{ github.event.workflow_run.head_repository.full_name || github.event.issue.number }}-${{ github.event.workflow_run.head_branch || github.event_name }}-${{ github.workflow }}
group: ${{ github.repository }}-${{ github.event_name == 'workflow_run' && format('{0}-{1}', github.event.workflow_run.head_repository.full_name, github.event.workflow_run.head_branch) || github.run_id }}-${{ github.workflow }}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks @LucaCappelletti94 — that cancellation was a real regression against main.

Pushed 17bc5a5 with your suggested group: workflow_run stays keyed by the head repository and branch, and issues / issue_comment now use github.run_id so a later comment cannot cancel an in-progress labeling run.

(AI-assisted reply.)

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.20%. Comparing base (bac1468) to head (055de06).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2891   +/-   ##
=======================================
  Coverage   83.20%   83.20%           
=======================================
  Files          42       42           
  Lines       36471    36471           
  Branches    36471    36471           
=======================================
  Hits        30345    30345           
  Misses       2632     2632           
  Partials     3494     3494           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

A second comment on the same pull request was sharing one concurrency
group and cancelling an in-progress issues/issue_comment labeling run,
so dialects declared in the cancelled comment were never applied. Main
has no concurrency block, so this restores that behavior.

Use github.run_id for those events and keep the pull-request
workflow_run group keyed by head repository and branch.

Signed-off-by: Vincent <ump45nose@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate dialect labeler away from pull_request_target

3 participants