# README
action-check-pr-title
This is a GitHub Action that ensures your PR title matches the Conventional Commits spec.
The typical use case is to use this in combination with a tool like semantic-release to automate releases.
Installation
- Add the action with the following configuration
name: "Check PR title"
on:
pull_request_target:
types:
- opened
- edited
jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: mangoGoForward/C@v
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Configuration
The action works without configuration, however you can provide options for customization.
The following terminology helps to understand the configuration options:
[feat][ui] Add `Button` component.
^ ^ ^
| | |__ Subject
| |_______ Scope
|____________ Type
with:
# Configure which types are allowed.
types: |
fix
feat
# Configure which scopes are allowed.
scopes: |
core
ui
# If you're using a format for the PR title that differs from the traditional Conventional
# Commits spec, you can use these options to customize the parsing of the type, scope and
# subject. The `headerPattern` should contain a regex where the capturing groups in parentheses
# correspond to the parts listed in `headerPatternCorrespondence`.
# See: https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser#headerpattern
headerPattern: '^(?:\[(\w+)\])?(?:\[(\w+)\])? (.+)$'
Event triggers
There are two events that can be used as triggers for this action, each with different characteristics:
pull_request_target
: This allows the action to be used in a fork-based workflow, where e.g. you want to accept pull requests in a public repository. In this case, the configuration from the main branch of your repository will be used for the check. This means that you need to have this configuration in the main branch for the action to run at all (e.g. it won't run within a PR that adds the action initially). Also if you change the configuration in a PR, the changes will not be reflected for the current PR – only subsequent ones after the changes are in the main branch.pull_request
: This configuration uses the latest configuration that is available in the current branch. It will only work if the branch is based in the repository itself. If this configuration is used and a pull request from a fork is opened, you'll encounter an error as the GitHub token environment parameter is not available. This option is viable if all contributors have write access to the repository.
# Packages
No description provided by the author