-
Notifications
You must be signed in to change notification settings - Fork 417
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
Assigns labels based on branch names #203
Conversation
FYI: I found that this wasn't working for me as expected. I got it working for me in joshdales#1. I didn't spend much time writing up any context, partly because this PR doesn't have any response, so I'm not sure if anyone is planning to take the time to review this. I'd be happy to communicate more about it if there's interest. EDIT: Updated PR reference. |
@amiel If it's not working properly I'm still interested so would appreciate any information you can give 😄 |
Hi @joshdales. I just realized that I referenced the wrong pull request in my last comment. I've edited it to reference the one I meant to reference: joshdales#1. The problem I ran in to was that Using |
I also considered updating your changes to support a list of branch patterns, just like the way lists of files are supported. However, I got it working by using the glob matching and I added a test to demonstrate that. This took me a little while to figure out because the minimatch documentation shows an example with |
Safer access of pull_request data. Co-authored-by: Josh Dales <30500472+joshdales@users.noreply.github.com>
@amiel took your suggestion and I've updated this PR to support a list of branch arguments as well 👍 |
@joshdales Awesome! I'll pull those changes upstream too since we are pinned to our branch until this gets actually released. |
To better follow the any convention as opposed to all
Be cool to get this feature shipped. I'd selfishly find it useful. |
Hi @joshdales and @lucacome! Sorry for the delay in responding! We had a discussion within the team and we decided to follow your recommendations. Let's update the @joshdales please revert your recent changes. Sorry for going back and forth, and thank you for your time and efforts! |
This reverts commit d4d4a10.
@MaksimZhukov Changes reverted 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @joshdales for the updates! Everything looks great, I left some minor comments
Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>
I really didn't want to add another comment, but...seems like something is not working... 😭 with the same config as usual:
I get
and the |
@lucacome I've pushed up a fix for this (and added a extra test based on your config so hopefully I don't accidentally break it again 🙈). Thanks for your support with the testing comments - it has been much appreciated 🙏 |
Hello everyone! @joshdales thanks for working on this PR, for your time and contribution! It was a pleasure to work with you! |
actions/labeler#203 was finally merged and actions/labeler created a pre-release with the changes. This updates the version of the action to use the official actions/labeler. It also updates labeler.yml with the new config format and adds missing change label.
actions/labeler#203 was finally merged and actions/labeler created a pre-release with the changes. This updates the version of the action to use the official actions/labeler. It also updates labeler.yml with the new config format and adds missing change label.
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/labeler](https://togithub.com/actions/labeler) | action | major | `v4.3.0` -> `v5.0.0` | --- ### Release Notes <details> <summary>actions/labeler (actions/labeler)</summary> ### [`v5.0.0`](https://togithub.com/actions/labeler/releases/tag/v5.0.0) [Compare Source](https://togithub.com/actions/labeler/compare/v4.3.0...v5.0.0) #### What's Changed This release contains the following breaking changes: 1. The ability to apply labels based on the names of base and/or head branches was added ([#​186](https://togithub.com/actions/labeler/issues/186) and [#​54](https://togithub.com/actions/labeler/issues/54)). The match object for changed files was expanded with new combinations in order to make it more intuitive and flexible ([#​423](https://togithub.com/actions/labeler/issues/423) and [#​101](https://togithub.com/actions/labeler/issues/101)). As a result, the configuration file structure was significantly redesigned and is not compatible with the structure of the previous version. Please read the [action documentation](https://togithub.com/actions/labeler/tree/main#pull-request-labeler) to find out how to adapt your configuration files for use with the new action version. 2. The bug related to the `sync-labels` input was fixed ([#​112](https://togithub.com/actions/labeler/issues/112)). Now the input value is read correctly. 3. By default, `dot` input is set to `true`. Now, paths starting with a dot (e.g. `.github`) are matched by default. 4. Version 5 of this action updated the [runtime to Node.js 20](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions). All scripts are now run with Node.js 20 instead of Node.js 16 and are affected by any breaking changes between Node.js 16 and 20. For more information, please read the [action documentation](https://togithub.com/actions/labeler/tree/main#pull-request-labeler). #### New Contributors - [@​joshdales](https://togithub.com/joshdales) made their first contribution in [https://github.com/actions/labeler/pull/203](https://togithub.com/actions/labeler/pull/203) - [@​dusan-trickovic](https://togithub.com/dusan-trickovic) made their first contribution in [https://github.com/actions/labeler/pull/626](https://togithub.com/actions/labeler/pull/626) - [@​sungh0lim](https://togithub.com/sungh0lim) made their first contribution in [https://github.com/actions/labeler/pull/630](https://togithub.com/actions/labeler/pull/630) - [@​TrianguloY](https://togithub.com/TrianguloY) made their first contribution in [https://github.com/actions/labeler/pull/629](https://togithub.com/actions/labeler/pull/629) **Full Changelog**: actions/labeler@v4...v5.0.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "on saturday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/sp3nx0r/homelab). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44Ny4yIiwidXBkYXRlZEluVmVyIjoiMzcuODcuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Description:
Assign a label based on the branch name.
Depending on your branch name you may want to apply different labels based on the purpose of the branch. You can specify the
base-branch
or thehead-branch
that you wish to apply the labels based on. The config options for the branch can be listed as a string or an array of strings.Puts all the branch matching, and changed files logic in their own files with some unit tests, and should hopefully create a good base for expanding with further options for matching options.
Related issues:
Check list:
Breaking Changes:
Changes the config structure so that the
any
andall
now have more options their original values are now under thechanged-files
key:If you omit a top level key it will default to
any
: