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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] add GitHub Action workflow to label PRs based on tools they touch #21751

Merged
merged 16 commits into from
Jan 10, 2024

Conversation

rogerluan
Copy link
Member

@rogerluan rogerluan commented Dec 22, 2023

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I see several green ci/circleci builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)
  • I've updated the documentation if necessary.
  • I've added or updated relevant unit tests.

Motivation and Context

We keep adding these labels manually, but only when a core contributor opens/reviews a PR. A handy tool that does this automatically for us, even before we review the PR, would be helpful!

Description

This workflow will automatically label PRs with e.g. tool: fastlane_core, type: ci, tool: deliver, etc. based on the directories that are being modified in the PR.

I'm wondering if I forgot any obvious rule we should be adding? What are other files associated to the type: ci label? Are there other labels we could automate based on file patterns?

Important

This automation will only kick in when PRs are open/reopened or a new commit is pushed to it. In other words, it won't update existing open PRs. We'd need to do this in a one-off basis somehow. I intend to rebase all open PRs so that should help adding labels to all PRs that don't have merge conflicts currently, otherwise, we could merge a GHA workflow that will be trigger on cron job and then remove it once it's run once. Lmk your thoughts on this 馃槆

Testing Steps

Check if it adds and removes the labels as promised, in this PR. Then, switch pull_request trigger to pull_request_target, so it works with forked PRs. Read this (https://github.com/actions/labeler#notes-regarding-pull_request_target-event) to understand why this switching is needed to test.

Screenshots of tests observed in this PR:

Labels successfully added by the bot once everything was configured correctly:

image image

Labels successfully removed when the code changed in those directories was removed:

image

Not sure if we should allow the bot to remove labels, see this comment of mine: #21751 (comment)

@rogerluan rogerluan self-assigned this Dec 22, 2023
Comment on lines 3 to 4
pull_request: # Temporary, for testing while PR is still open
# pull_request_target
Copy link
Member Author

Choose a reason for hiding this comment

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

Note to reviewers: please don't merge this PR with this code in. Before merging, we need to delete pull_request and uncomment pull_request_target.

See https://github.com/actions/labeler#notes-regarding-pull_request_target-event for more details

Co-authored-by: Jerome Lacoste <jerome.lacoste@gmail.com>
@rogerluan rogerluan merged commit 8a58765 into master Jan 10, 2024
6 checks passed
@rogerluan rogerluan deleted the rogerluan/tool-labeler branch January 10, 2024 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants