ghaction-github-labeler
ghaction-github-labeler copied to clipboard
GitHub Action to manage labels on GitHub
About
GitHub Action to manage labels on GitHub (create/rename/update/delete) as code.
If you are interested, check out my other :octocat: GitHub Actions!

- Usage
- YAML configuration
- Workflow
- Customizing
- inputs
- Contributing
- License
Usage
YAML configuration
In the repository where you want to perform this action, create the YAML file .github/labels.yml (you can also set a custom filename) that looks like:
- name: "bug"
color: "d73a4a"
description: "Something isn't working"
- name: "documentation"
color: "0075ca"
description: "Improvements or additions to documentation"
- name: "duplicate"
color: "cfd8d7"
description: "This issue or pull request already exists"
- name: "enhancement"
color: "a22eef"
- name: "wontfix_it"
color: "000000"
description: "This will not be worked on"
from_name: "wontfix"
name,coloranddescriptionare the main GitHub label fieldsdescriptioncan be omit if your want to keep the current onefrom_nameallow to rename a label from one currently available on your repository
Workflow
name: github
on: push
jobs:
labeler:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Run Labeler
if: success()
uses: crazy-max/ghaction-github-labeler@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
yaml-file: .github/labels.yml
skip-delete: false
dry-run: false
exclude: |
help*
*issue
With this workflow, the YAML configuration above on a fresh repository, this will:
- Skip
bug(because samecoloranddescription) - Skip
documentation(because samecoloranddescription) - Update
duplicate(coloris different) - Update
enhancement(coloris different, keep currentdescription) - Leave
good first issuealone (because it matches anexcludepattern) - Leave
help wantedalone (because it matches anexcludepattern) - Delete
invalid - Delete
question - Rename
wontfixtowontfix_itand setcoloranddescription
Customizing
inputs
Following inputs can be used as step.with keys
| Name | Type | Description |
|---|---|---|
github-token |
String | GitHub Token as provided by secrets. (default ${{ github.token }}) |
yaml-file |
String | Path to YAML file containing labels definitions. (default .github/labels.yml) |
skip-delete |
Bool | If enabled, labels will not be deleted if not found in YAML file. (default false) |
dry-run |
Bool | If enabled, changes will not be applied. (default false) |
exclude |
List | Newline delimited list of labels pattern(s)/matcher to exclude |
Contributing
Want to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. If you want to open a pull request, please read the contributing guidelines.
You can also support this project by becoming a sponsor on GitHub or by making a Paypal donation to ensure this journey continues indefinitely!
Thanks again for your support, it is much appreciated! :pray:
License
MIT. See LICENSE for more details.