Skip to content

Project management: automate adding package-related labels to PRs#52729

Merged
priethor merged 10 commits into
trunkfrom
automation/auto-label-prs
Dec 17, 2025
Merged

Project management: automate adding package-related labels to PRs#52729
priethor merged 10 commits into
trunkfrom
automation/auto-label-prs

Conversation

@priethor
Copy link
Copy Markdown
Contributor

What?

This PR automates adding package-related labels to PRs when they affect one or more npm packages. Related discussions in #52583 and #52727 (comment)

Why?

Labeling in detail is a burden, and often PRs get merged without many labels. Some labels can be automated, like package labels and many feature-related ones.

How?

By adding a labeler GitHub action that checks the path of the files affected by the PRs.

Testing Instructions

I've created a PoC in a test repository, and it seems to work fine!

@priethor priethor added the [Type] Project Management Meta-issues related to project management of Gutenberg label Jul 18, 2023
@priethor priethor self-assigned this Jul 18, 2023
Comment thread .github/labeler.yml Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 18, 2023

Flaky tests detected in dc4d694.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18982729378
📝 Reported issues:

Copy link
Copy Markdown
Contributor

@jordesign jordesign left a comment

Choose a reason for hiding this comment

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

It's beyond my skillset to comment on the code itself - but in terms of the labels being added it looks good to me

@priethor
Copy link
Copy Markdown
Contributor Author

Thanks for taking a look, @jordesign . There are some label mismatches between the current labels and packages, as I noted in the spreadsheet from #52583. Since package labels should be a direct 1:1 mapping, I will move forward to updating them if you don't mind.

@priethor priethor requested a review from apeatling July 19, 2023 16:09
Copy link
Copy Markdown
Contributor

@apeatling apeatling left a comment

Choose a reason for hiding this comment

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

This looks great, and should help the problem quite a bit. Looks thorough to me but I will hold off on approval until you have the label mismatches sorted.

@afercia
Copy link
Copy Markdown
Contributor

afercia commented Sep 4, 2023

Slightly unrelated and maybe it would have been better addressed in the contrext of #52583

I just noticed that there's no label for the existing package @wordpress/customize-widgets.
I'm not sure what the state of this package is, but it seems to me the lack of a label is inconsistent with the similar package @wordpress/edit-widgets which does have its own label: [Package] Edit Widgets.

Actual use case: I'd need the missing label to be added to #54148

@priethor priethor force-pushed the automation/auto-label-prs branch from 9973baa to 2236c90 Compare October 31, 2025 15:09
@priethor priethor requested a review from desrosj as a code owner October 31, 2025 15:09
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Oct 31, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @apeatling.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: apeatling.

Co-authored-by: priethor <priethor@git.wordpress.org>
Co-authored-by: jordesign <jordesign@git.wordpress.org>
Co-authored-by: desrosj <desrosj@git.wordpress.org>
Co-authored-by: afercia <afercia@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@priethor priethor added GitHub Actions Pull requests that update GitHub Actions code [Type] Project Management Meta-issues related to project management of Gutenberg and removed [Type] Project Management Meta-issues related to project management of Gutenberg labels Nov 3, 2025
desrosj
desrosj previously requested changes Nov 3, 2025
Comment thread .github/labeler.yml Outdated
Comment thread .github/workflows/pr-labeling-automation.yml Outdated
Comment thread .github/workflows/pr-labeling-automation.yml
Comment thread .github/workflows/pr-labeling-automation.yml Outdated
Comment thread .github/workflows/pr-labeling-automation.yml Outdated
Comment thread .github/workflows/pr-labeling-automation.yml Outdated
Comment thread .github/workflows/pr-labeling-automation.yml Outdated
Comment thread .github/labeler.yml
@@ -0,0 +1,255 @@
# Package labeling rules - only labels that exist on GitHub
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there any way to automate this list? Looking quickly, it seems that the part of the label after [Package] can just be coerced into lowercase and spaces replaced with hyphens to construct the directory path. For example, [Package] API Fetch -> packages/api-fetc/**. The only one where this is not the case is the [Package] E2E Tests.

We just removed a manually-curated list in #72672, so want to make sure that adding a new file for something similar is the desired solution.

I don't know if this is possible, but what if there was a step prior to this one that queried for all of the active [Package] labels for the repository and then created this file or a list on the fly each time?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think it can be done, there are only a few exceptions like e2e and some typos that can be fixed at the label level.

I'd be happy to attempt that in a follow-up, to get this up and running first and see how it works before investing too much time in that. At the end of the day, label mismatches won't harm PRs as opposed to the Type-label enforcer, which would leave annoying messages and block merging.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually:

  • I've fixed the two labels that had a typo/mismatch
  • For the exceptions, we can use the label description as a backup. They contain the patch of the package they should be "assigned" to, so we can use label descriptions to do the match in the workflow.

@priethor priethor merged commit 229fe11 into trunk Dec 17, 2025
34 checks passed
@priethor priethor deleted the automation/auto-label-prs branch December 17, 2025 19:38
@github-actions github-actions Bot added this to the Gutenberg 22.4 milestone Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GitHub Actions Pull requests that update GitHub Actions code [Type] Project Management Meta-issues related to project management of Gutenberg

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants