banyan / auto-label

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

Home Page:https://github.com/marketplace/actions/auto-label-action

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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@1.2
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

NOTE: pull_request event is triggered by many actions, so please make sure to filter by [opened, synchronize] of on.<event_name>.types as in the example above.

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)

About

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

https://github.com/marketplace/actions/auto-label-action

License:MIT License


Languages

Language:TypeScript 88.3%Language:JavaScript 8.2%Language:Shell 3.6%