An action for automatically labelling pull requests
This release contains the following breaking changes:
The ability to apply labels based on the names of base and/or head branches was added (#186 and #54). The match object for changed files was expanded with new combinations in order to make it more intuitive and flexible (#423 and #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 to find out how to adapt your configuration files for use with the new action version.
The bug related to the sync-labels
input was fixed (#112). Now the input value is read correctly.
By default, dot
input is set to true
. Now, paths starting with a dot (e.g. .github
) are matched by default.
Version 5 of this action updated the runtime to Node.js 20. 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.
Full Changelog: https://github.com/actions/labeler/compare/v4...v5.0.0
In scope of this beta release, the structure of the configuration file (.github/labeler.yml
) was changed from
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']
to
LabelName:
- any:
- changed-files:
- AnyGlobToAnyFile: ['list', 'of', 'globs']
- AnyGlobToAllFiles: ['list', 'of', 'globs']
- AllGlobsToAnyFile: ['list', 'of', 'globs']
- AllGlobsToAllFiles: ['list', 'of', 'globs']
- base-branch: ['list', 'of', 'regexps']
- head-branch: ['list', 'of', 'regexps']
- all:
- changed-files:
- AnyGlobToAnyFile: ['list', 'of', 'globs']
- AnyGlobToAllFiles: ['list', 'of', 'globs']
- AllGlobsToAnyFile: ['list', 'of', 'globs']
- AllGlobsToAllFiles: ['list', 'of', 'globs']
- base-branch: ['list', 'of', 'regexps']
- head-branch: ['list', 'of', 'regexps']
This is a beta 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.
In the implementation of the alpha version there were two options for changed-files:
any
(ANY glob must match against ANY changed file) andall
(ALL globs must match against ALL changed files).In scope of this PR, we expanded this functionality and provided the following combinations:
AnyGlobToAnyFile
- ANY glob must match against ANY changed fileAllGlobsToAnyFile
- ALL globs must match against ANY changed fileAnyGlobToAllFiles
- ANY glob must match against ALL changed filesAllGlobsToAllFiles
- ALL globs must match against ALL changed filesany
and all
top-level keys work?Top-level keys (any
and all
) bind options (changed-files
, base-branch
, head-branch
) in the following ways:
all
: all of the provided options (changed-files
, base-branch
, etc.), glob combinations (AnyGlobToAnyFile
, AllGlobsToAnyFile
, etc.) and regexps must match for the label to be applied.any
: any of the provided options (changed-files
, base-branch
, etc.), glob combinations (AnyGlobToAnyFile
, AllGlobsToAnyFile
, etc.) and regexps must match for the label to be applied.If an option is specified without a top-level key, it will default to any.
# 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:
- all:
- changed-files:
- AnyGlobToAnyFile: ['src/**/*.js']
- AllGlobsToAllFiles: ['!src/main.js']
- base-branch: 'main'
Full Changelog: https://github.com/actions/labeler/compare/v5.0.0-alpha.1...v5.0.0-beta.1
In scope of this release, the ability to specify pull request number(s) was added by @credfeto in https://github.com/actions/labeler/pull/349.
Support for reading from the configuration file presented on the runner was added by @lrstanley in https://github.com/actions/labeler/pull/394. It allows you to use a configuration file generated during workflow run or uploaded from a separate repository.
Please refer to the action documentation for more information.
This release also includes the following changes:
Full Changelog: https://github.com/actions/labeler/compare/v4...v4.3.0
In the scope of this release, the following outputs were added by @danielsht86 in #60:
new-labels
- a comma-separated string that contains all newly added labels.all-labels
- a comma-separated string that contains all labels currently assigned to the PR.For detailed information, please refer to our updated documentation.
The issue of encountering an HttpError: Server Error
when adding more than 50 labels has been successfully resolved by @markmssd in #497. However, it's important to note that the GitHub API imposes a limit of 100 labels. To ensure smooth operation, a warning message that will alert you if the number of labels exceeds this limit was implemented. From this point forward, if more than 100 labels are specified, only the first 100 will be assigned.
The error handling for the Resource not accessible by integration
error was added by @jsoref in #405. Now, if the workflow is misconfigured, the labeler provides a clear warning and guidance for correction.
This release also includes the following changes:
Full Changelog: https://github.com/actions/labeler/compare/v4...v4.2.0
In scope of this release, the dot
input was added by @kachkaev in https://github.com/actions/labeler/pull/316. It allows patterns to match paths starting with a period. This input is set to false
by default.
name: "Pull Request Labeler"
on:
- pull_request_target
jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
with:
dot: true
This release also includes the following changes:
Full Changelog: https://github.com/actions/labeler/compare/v4...v4.1.0
This alpha release introduces the following major changes:
sync-labels
input. Now the input value is read correctly. https://github.com/actions/labeler/pull/480
any
selector 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.
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']
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/*']
feature
label to any PR where the head branch name starts with feature
or has feature
in the namefeature:
- head-branch: ['^feature', 'feature']
release
label to any PR that is open against the main
branchrelease:
- base-branch: 'main'
test
label to any PR that is open against the main
branch and the head branch name starts with feature
test:
- all:
- base-branch: 'main'
- head-branch: '^feature'
test
label if there are any changes in the *.js files within the source directory or within the __tests__
directory, or the head branch name starts with example
test:
- any:
- changed-files: ['__tests__/**/*.js', 'src/**/*.js']
- head-branch: '^example'
Full Changelog: https://github.com/actions/labeler/compare/v4...v4.0.4
@actions/core
dependency to v1.9.1
to pull in recent security fixes