This action automatically renames a PR using a regex with named groups and custom format.
Required Regex with named groups used to process the PR's source branch.
Required String format using the branch-regex
named groups that will construct a clean PR title.
There are 2 special transforms available
{group!upper}
- will transform the group to upper case.{group!normalize}
- will transform the group, replacing non words with space, converting to title case, and trimming the resulting string.
Optional String format using the branch-regex
named groups, if the original title starts with this format, auto formatting is skipped.
The groups that were matched by the branch-regex
.
The original title of the PR.
The formatted title that this action applied to the PR.
It is recommended that you only run this action when a PR is opened so you do not overwrite a custom title.
on:
pull_request:
types: [opened]
Example step
name: Rename PR
uses: CyberGRX/pr-rename-action@v1.1
id: pr-auto-namer
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch-regex: '(?<prefix>.*?)(?<team>[\d\w]+)-(?<ticket>\d+)(?<postfix>.*)'
title-format: '{team!upper}-{ticket!upper}: {postfix!normalize}'
check-format: '{team!upper}-{ticket!upper}'