What's Changed
This alpha release introduces the following major changes:
- Fix the bug related to the
sync-labelsinput. Now the input value is read correctly. #480 - Add the ability to apply labels based on base and/or head branch names. #203
- Change the behavior of the
anyselector to match ANY file against ANY glob pattern.
This is an alpha version and we would appreciate it if you could provide us with your feedback. If you have any questions, ideas or concerns, please share them in the corresponding issue.
Usage
The match object allows you to control the matching options. You can specify the label to be applied based on the changed files and/or the name of the base or head branch. For the changed files, you have to provide a path glob, and for the branches, you have to provide a regexp to match against the branch name.
Please note that the structure of the configuration file (.github/labeler.yml) has been changed! There are two top-level keys: any and all, that accept the same configuration options:
LabelName:
- any:
- changed-files: ['list', 'of', 'globs']
- base-branch: ['list', 'of', 'regexps']
- head-branch: ['list', 'of', 'regexps']
- all:
- changed-files: ['list', 'of', 'globs']
- base-branch: ['list', 'of', 'regexps']
- head-branch: ['list', 'of', 'regexps']How do the any and all keys work?
all: all of the provided options (changed-files,base-branch, etc.) must match for the label to be applied. ALL globs or regexps must match against branch names or ALL changed files.any: any of the provided options (changed-files,base-branch, etc.) must match for the label to be applied. ANY globs or regexps must match against branch names or ANY changed files.
Note: The behavior of the any selector for changed files has been changed to match ANY file against ANY glob pattern.
# Add the `frontend` label to any change to any *.js files as long as the `main.js` hasn't been changed and the PR is open against the `main` branch
frontend:
- any:
- changed-files: ['src/**/*.js']
- all:
- changed-files: ['!src/main.js']
- base-branch: 'main'If an option is specified without a top-level key, it will default to any. In particular, the following two configurations are equivalent:
LabelName:
- changed-files: src/*and
LabelName:
- any:
- changed-files: ['src/*']More examples
- Add the
featurelabel to any PR where the head branch name starts withfeatureor hasfeaturein the name
feature:
- head-branch: ['^feature', 'feature']- Add the
releaselabel to any PR that is open against themainbranch
release:
- base-branch: 'main'- Add the
testlabel to any PR that is open against themainbranch and the head branch name starts withfeature
test:
- all:
- base-branch: 'main'
- head-branch: '^feature'- Add the
testlabel if there are any changes in the *.js files within the source directory or within the__tests__directory, or the head branch name starts withexample
test:
- any:
- changed-files: ['__tests__/**/*.js', 'src/**/*.js']
- head-branch: '^example'New Contributors
- @adam-azarchs made their first contribution in #480
- @joshdales made their first contribution in #203