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

New config structure for labeler #3

Merged
merged 17 commits into from
Feb 21, 2023
Merged

New config structure for labeler #3

merged 17 commits into from
Feb 21, 2023

Conversation

joshdales
Copy link
Owner

@joshdales joshdales commented Jan 29, 2023

Description:
Start of a new config structure for the labeler action - it no longer defaults to checking paths, you need to specify changed-files in your labeler config file. Also adds head-branch and base-branch options for adding labels based on those branch names.

Also moves all the branch checking related logic into it's own file and adds unit tests for that.

This is what the labeler.yml will end up looking like after these changes:

label:
  - changed-files:
    - any: ['list', 'of', 'globs']
    - all: ['list', 'of', 'globs']
  - base-branch: ['list', 'of', 'regexps']
  - head-branch: ['list', 'of', 'regexps']

🤔 I'm trying not to refactor more of this than I need to - but I wonder if this as it is is potentially going to make things a little bit more confusing for a while, partly because it was all written around the sole option of file changes and now that is not the only way to use this action. So there are things like globs being referenced in a lot of function names which is kinda weird now.

And because we have nested options now and not each matchconfig individually in it's own item as a part of the map I'm reversing the conditions of checkMatch so that if any condition is successful then we apply the label rather than checking for all the options and if any fails then return.

@joshdales joshdales closed this Jan 29, 2023
@joshdales joshdales reopened this Jan 29, 2023
@joshdales joshdales marked this pull request as draft January 29, 2023 20:23
@joshdales joshdales marked this pull request as ready for review February 20, 2023 02:31
@joshdales joshdales merged commit 8943ca2 into main Feb 21, 2023
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.

1 participant