The Validate Pull Request Title GitHub Action checks if the title of a pull request meets specified criteria, including length constraints and required prefixes. It helps maintain consistency and clarity in pull request titles within your repository.
To use this action, you need to provide the following inputs:
pull-request-title
: The title of the pull request. (required)case-sensitive-prefix
: Whether to enforce case sensitivity for prefixes. Defaults to true. (optional)max-length-title
: The maximum allowed length for the pull request title. Defaults to "100" characters. (optional)min-length-title
: The minimum required length for the pull request title. Defaults to "10" characters. (optional)allowed-prefixes
: A comma-separated list of prefixes that are allowed in pull request titles. (required)
name: Validate Pull Request Title Example
on:
pull_request:
types: [opened]
jobs:
validate-title:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Validate Pull Request Title
id: validate-title
uses: felleslosninger/validate-pull-request-title@v1
with:
pull-request-title: ${{ github.event.pull_request.title }}
allowed-prefixes: "fix,feat,docs,refactor,chore"
- name: Print validation result
run: echo "Is title valid? ${{ steps.validate-title.outputs.is-valid }}"
The title of the pull request.
Whether to enforce case sensitivity for prefixes. Defaults to true.
The maximum allowed length for the pull request title.
The minimum required length for the pull request title.
A comma-separated list of prefixes that are allowed in pull request titles.
A boolean indicating whether the pull request title is valid.
A detailed message indicating why the pull request title is invalid. This may include information such as exceeding maximum length, not meeting minimum length, or lacking required prefixes.
This action is licensed under the MIT License.
Contributions are welcome! Feel free to open an issue or submit a pull request.
This action is maintained by the Digdir Platform Team.