Comprehensive toolkit for GitHub developers and teams
Learn how to automate GitHub issue and PR labeling using patterns and the GitHub API.
Configure automatic labels based on keywords found in issues and pull requests:
{{
"labelRules": [
{{"keywords": ["bug", "error", "crash"], "label": "bug", "color": "d73a49"}},
{{"keywords": ["feature", "new", "add"], "label": "feature", "color": "28a745"}},
{{"keywords": ["docs", "readme"], "label": "documentation", "color": "0366d6"}}
]
}}
curl -X POST \
https://api.github.com/repos/OWNER/REPO/labels \
-H "Authorization: token YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{{
"name": "bug",
"color": "d73a49",
"description": "Something isn't working"
}}'
name: Auto Label
on:
issues:
types: [opened, edited]
pull_request:
types: [opened, edited]
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
with:
repo-token: ${{{{ secrets.GITHUB_TOKEN }}}}