fregante / title-to-labels-action

Cleans up the titles of issues and PRs from common opening keywords

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

title-to-labels-action

Cleans up the titles of issues and PRs from common opening keywords

GitHub offers issue templates with pre-defined labels, but that doesn't stop users from cluttering the titles with the same piece of information already offered by labels.

This action:

  • removes the specified keywords at the beginning of issue titles;
  • optionally add related labels.

You can either run it without inputs to use its defaults or specify your own keywords/labels combination.

Title examples:

User title ➡️ Updated title ➡️ Added labels
Bug - some error happened Some error happened bug triage
[Feature request] prepare coffee Prepare coffee enhancement
Suggestion: add more tags Add more tags none, title-change only

Note: keywords in titles are only recognized if followed by one of these characters: :-)]

Usage

Note: If no inputs are supplied, the action will use the defaults.

name: Labeler

on:
  pull_request_target:
    types: [opened, edited]
  issues:
    types: [opened, edited]

jobs:
  Label:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - uses: fregante/title-to-labels-action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

You can automatically install the above with ghat:

npx ghat fregante/title-to-labels-action/workflow

Inputs

Note: If no inputs are supplied, the action will use the defaults.

  • keywords - The keywords to look for, separed by comma or newline. Case-insensitive.
  • labels - The labels to apply when one of the keywords was found. Optional.

Either use one keyword per line or comma-separed values. Note: Do not use lists starting with -, Actions doesn't support them.

Examples:

name: Labeler

on:
  pull_request_target:
    types: [opened, edited]
  issues:
    types: [opened, edited]

jobs:
  Label:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - uses: fregante/title-to-labels-action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          keywords: idea
          # If you don't specify `labels`, the action will just clean up the titles from your keywords.

      # The action can be used as many times as needed in a single job
      - uses: fregante/title-to-labels-action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          keywords: bug, bug report
          labels: bug

      - uses: fregante/title-to-labels-action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          keywords: |
            feature request
            suggestions
            enhancement
          labels: |
            enhancement

Outputs

None.

Related

  • 🛕 action-release - A workflow to help you release your actions
  • daily-version-action - Creates a new tag using the format Y.M.D, but only if HEAD isn’t already tagged.
  • setup-git-user - GitHub Action that sets git user and email to enable committing

About

Cleans up the titles of issues and PRs from common opening keywords

License:MIT License


Languages

Language:JavaScript 100.0%