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

GitHub Action

Auto Label Action

1.0

Auto Label Action

flag

Auto Label Action

Add labels to Pull Request based on matched file patterns

Installation

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

              

- name: Auto Label Action

uses: banyan/[email protected]

Learn more about this action in banyan/auto-label

Choose a version

auto-label

A GitHub action to add labels to Pull Request based on matched file patterns

Installation

To configure the action simply add the following lines to your .github/workflows/auto-label.yml file:

name: Auto Label
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  auto-label:
    name: Auto Label
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: banyan/auto-label@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

And configure by creating .github/auto-label.json file. The format is label: rule:

{ [key: string]: string | string[] }

Pattern matching is following .gitignore spec using by node-ignore.

{
  "rules": {
    "frontend": ["*.js", "*.css", "*.html"],
    "backend": ["app/", "*.rb"],
    "ci": ".circleci"
  }
}

Features

Tips

  • In case if you want to debug the response quickly, just set ACTIONS_STEP_DEBUG as true on Secrets from Settings of GitHub.

TODO

  • Handle pagination of label (currently only handles 100)

License

MIT