This action is compatible with actions/labeler and can use existing label definition files (such as labeler.yml) without modification.
- Compatible with actions/labeler: You can use your existing label definition files without any changes.
- Flexible triggers: Can be executed on events other than
on: pull_request(e.g.,push,workflow_dispatch, etc.), allowing labeling processes outside of pull request events. - Enhanced label settings: Supports setting label
coloranddescriptionin the configuration file. - CodeOwners filtering: Filter labels based on code owners using the
codeownersfield. - Author filtering: Filter labels based on PR author using the
authorfield (supports regular expressions and team names). - Team member expansion: Expand GitHub team members by adding
...suffix to team names (e.g.,org/team...).
- Prepare a label definition file (e.g.,
.github/labeler.yml):
ci:
- any:
- changed-files:
- any-glob-to-all-files: '.github/**'
- all-files-to-any-glob:
- '*.yml'
- '.github/**'
# - all-files-to-any-glob:
# - '*.yml'
# - '.github/**'
- color: '#7c0bb2'
- codeowners:
- srz-zumix
- "@org/team"
- "org/team..." # expand team members
- author: '@myorg/developers'
bot:
- author: '.*\[bot\]$'Note:
Thecolor,description,codeowners, andauthorsettings are ignored byactions/labeler. It will not cause an error.
Theall-files-to-any-globunderchanged-filesis not compatible withactions/labeler. If you want a configuration file that can be loaded byactions/labeler, writeall-files-to-any-globat the same level aschanged-files.
If you want to expand teams, you need a token with read access to team members.
- Call this action in your workflow:
name: Labeler
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review # for review-request: ready_for_review/always_reviewable
workflow_dispatch:
inputs:
pr-number:
description: 'The pull request number(s)'
required: true
jobs:
labeler:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
pull-requests: write
steps:
- uses: srz-zumix/labeler-action@v0
with:
pr-number: ${{ github.event.inputs.pr-number || github.event.number }}
review-request: ready_for_review| Name | Description |
|---|---|
| GH_HOST | Specify the GitHub hostname |
| GH_TOKEN | Takes priority over inputs.repo-token |
| GH_ENTERPRISE_TOKEN | Takes priority over inputs.repo-token |
| AQUA_GITHUB_TOKEN | Set AQUA_GITHUB_TOKEN to avoid rate limits |