Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
tag

GitHub Action

GitHub Labeler

v3.1.1

GitHub Labeler

tag

GitHub Labeler

GitHub Action to manage labels on GitHub

Installation

Copy and paste the following snippet into your .yml file.

              

- name: GitHub Labeler

uses: crazy-max/ghaction-github-labeler@v3.1.1

Learn more about this action in crazy-max/ghaction-github-labeler

Choose a version

GitHub release GitHub marketplace Test workflow Codecov Become a sponsor Paypal Donate

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!

GitHub Labeler


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, color and description are the main GitHub label fields
  • description can be omit if your want to keep the current one
  • from_name allow 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@v2
      -
        name: Run Labeler
        if: success()
        uses: crazy-max/ghaction-github-labeler@v3
        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 same color and description)
  • Skip documentation (because same color and description)
  • Update duplicate (color is different)
  • Update enhancement (color is different, keep current description)
  • Leave good first issue alone (because it matches an exclude pattern)
  • Leave help wanted alone (because it matches an exclude pattern)
  • Delete invalid
  • Delete question
  • Rename wontfix to wontfix_it and set color and description

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

Keep up-to-date with GitHub Dependabot

Since Dependabot has native GitHub Actions support, to enable it on your GitHub repo all you need to do is add the .github/dependabot.yml file:

version: 2
updates:
  # Maintain dependencies for GitHub Actions
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "daily"

How can I help?

All kinds of contributions are welcome ๐Ÿ™Œ! The most basic way to show your support is to star ๐ŸŒŸ the project, or to raise issues ๐Ÿ’ฌ 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! ๐Ÿ™

License

MIT. See LICENSE for more details.