Skip to content

Latest commit

 

History

History
123 lines (93 loc) · 4.92 KB

README.md

File metadata and controls

123 lines (93 loc) · 4.92 KB

GitHub release GitHub marketplace Test workflow Support me on Patreon Paypal Donate

✨ About

GitHub Action to manage labels on GitHub (create/rename/update/delete) as code.

⚠️ Note: To use this action, you must have access to the GitHub Actions feature. GitHub Actions are currently only available in public beta. You can apply for the GitHub Actions beta here.

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@v1
      -
        name: Run Labeler
        if: success()
        uses: crazy-max/ghaction-github-labeler@v1
        with:
          yaml_file: .github/labels.yml
          exclude: "['help*', '*issue']"
          skip_delete: false
          dry_run: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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
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 String¹ If present, prevents changes to labels that match the given pattern(s).

¹ The exclude option accepts only a single string, but that string can contain a YAML array of strings:

exclude: 'help*'
exclude: "['help*', '*bug*', '*issue']"

environment variables

Following environment variables can be used as step.env keys

Name Description
GITHUB_TOKEN GITHUB_TOKEN as provided by secrets

🤝 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 💬
But we're not gonna lie to each other, I'd rather you buy me a beer or two 🍻!

Support me on Patreon Paypal Donate

📝 License

MIT. See LICENSE for more details.