/ag-pr-labeler

Github action to add labels in PRs by commit name

Primary LanguageJavaScript

GitHub PR Labeler based on commit messages

This action add lables to your PR. These labels are based on your pr's commits messages.

Inputs

Name Type Description Required
createRepoLabels string This action can create all necessary labels, to do so, this flag must be active false
githubToken string GH token that will provide the permissions to read and write in your repository true

Usage

Include this action in your workflow file. Here is an example:

on:
  pull_request:
    types: [opened] #only closed pr

jobs:
  labeler:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Run label CI
        uses: AntonioGally/ag-pr-labeler/@main
        with:
          createRepoLabels: true
          githubToken: ${{ secrets.GITHUB_TOKEN }} #Github default token, PATs are recomended

Observations

This action uses the conventional commits guideline to add labels. The code read all commits inside the PR and with regex, extract the type of each commit. For each commit type, one label is added. Besides that, if you're merging a branch with the prefix itsm or hotfix, will be added labels for those as well.

Example

image
image

Contributing

Just send a nice PR that I'll review it with love :D Or just email me as well I'll read

Under the hood

(Not ready yet, but go take a look at the code, u can do this :D)

Contacts