Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use github wf to add module labels for PR based on file changes #14101

Merged
merged 2 commits into from
Feb 2, 2025

Conversation

pseudo-nymous
Copy link
Contributor

@pseudo-nymous pseudo-nymous commented Jan 4, 2025

Description

Adds a new bot to automate labelling of pull requests with module tags based on file changes.
This bot uses .github/labeler.yml file to maintain mapping for module labels to corresponding regex paths to track.

This workflow is triggered using pull_request_target event which provides necessary write permission for adding labels to PRs. More details around this event: StackOverflow

Testing

Tested changes by creating pr on my own fork. pseudo-nymous#2

Further testing with sync flag: pseudo-nymous#3

Closes #13897

Copy link

This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the [email protected] list. Thank you for your contribution!

@github-actions github-actions bot added the Stale label Jan 19, 2025
@stefanvodita
Copy link
Contributor

@pseudo-nymous, I'm only seeing this now, sorry! At first glance, it matches what I had in mind - thank you for addressing that issue! I'll do an in-depth review soon, but I'd appreciate others' thoughts as well. One potential concern is our GitHub action budget - do you have a sense of the cost of this workflow?

Copy link
Contributor

@stefanvodita stefanvodita left a comment

Choose a reason for hiding this comment

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

This is great @pseudo-nymous! I left minor comments that I would like to see addressed, but this is very good already. I retract my concern about the action budget. This is running when a PR is created or updated, which is not that often.

@github-actions github-actions bot removed the Stale label Jan 30, 2025
@pseudo-nymous
Copy link
Contributor Author

Did further testing with new sync flag, change is working as expected.
Ref: pseudo-nymous#3

@pseudo-nymous
Copy link
Contributor Author

This is great @pseudo-nymous! I left minor comments that I would like to see addressed, but this is very good already. I retract my concern about the action budget. This is running when a PR is created or updated, which is not that often.

Thanks.

Yes, this bot is only triggered when when pr is created or updated.

I have addressed all the comments. Please take a look.

Copy link
Contributor

@stefanvodita stefanvodita left a comment

Choose a reason for hiding this comment

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

Thank you for responding to the comments so quickly! I've one more small thing to add and if that's sorted I'll leave it a few days to see if others have feedback, then merge.

@mikemccand
Copy link
Member

Wow, this looks really awesome! I wish we could retroactively apply it to PRs missing their module labels ... but let's start with this change (so new PRs are labeled).

@stefanvodita stefanvodita merged commit b13d37f into apache:main Feb 2, 2025
5 checks passed
@stefanvodita
Copy link
Contributor

Thank you for this contribution @pseudo-nymous, I merged it just now and I'm really looking forward to see the first PR using it!

@pseudo-nymous
Copy link
Contributor Author

Thanks.

I checked if same script could be used to label older PRs but there is no such event corresponding to already closed PR.
Maybe we can write an individual script which could process already closed PRs and label them. I will further explore on this.

@stefanvodita
Copy link
Contributor

Brilliant! Let us know if you find anything. If you're interesting in this area of GitHub workflows / community tools, there are a few others that would be great to do:

  1. Create a bot to check if there is a CHANGES entry for new PRs #13898
  2. Create a bot to add milestones to new PRs #14190
  3. Create a community metrics dashboard #13896

@pseudo-nymous
Copy link
Contributor Author

I'll be happy to work on these. Thanks!

@stefanvodita
Copy link
Contributor

I've seen new PRs get labels assigned. I like how it's working!

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.

Create bot to label PRs based on the files they touch
3 participants