title-replacer-action

Replaces and formats keywords in titles of issues and PRs

MIT License

Stars
1
Committers
1

title-replacer-action

Replaces, formats or removes keywords in titles of issues and PRs.

Examples

Enforce a format for certain words:

- "monorepo-package" SyntaxError: ๐Ÿ„ not allowed here
+ `monorepo-package` - SyntaxError: ๐Ÿ„ not allowed here

Auto-fix common misspellings

- RGBA colours are not supported
+ RGBA colors are not supported

Ensure your brand is untarnished by lowercaseness:

- Lost all files due to steam
+ Lost all files due to Steam

You can automatically install a demo workflow with ghat:

npx -y ghat fregante/title-replacer-action/workflow

Usage

name: Labeler

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

jobs:
  Label:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
      issues: write
    steps:
      - name: Turn keywords into `keywords`
        uses: fregante/title-replacer-action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          patterns: alpha, omega
          replacement: '`$0`'

      - name: Turn keywords from file into `keywords`
        uses: fregante/title-replacer-action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          patterns-path: source/list.txt
          replacement: '($0)'

      - name: Read list of files in directory, use the extension-less names as patterns
        uses: fregante/title-replacer-action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          
          patterns-path: source/features
          replacement: '[$0]'

      # The action can be used as many times as needed in a single job
      - uses: fregante/title-replacer-action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          patterns: |
            alpha
            omega
          replacement: '$0: '

      - uses: fregante/title-replacer-action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          patterns: /^fix(es)?/i
          replacement: 'fix: '

Inputs

See action.yml

Outputs

See action.yml

Related

  • title-to-labels-action - Cleans up the titles of issues and PRs from common opening keywords.
  • ๐Ÿ›• 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