Enforce title and body of your pull requests via regular expressions.
Add ./github/workflows/ci.yml
to your main
branch:
name: CI
on:
pull_request_target:
types:
- opened
- reopened
- edited
- synchronize
jobs:
pr:
name: Pullforcer
runs-on: ubuntu-latest
steps:
- uses: radulle/[email protected]
# If you run locally copy action.yml and dist contents to .github/actions/pullforcer and replace previous line with:
# - uses: actions/checkout@v3
# - uses: ./.github/actions/pullforcer
with:
pr-title-regexp: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(?:\(([a-z\-\.,]+)\))?(!)?: ([0-9a-z\-\., <>()\[\]]{4,})$'
Regular expression. ^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(?:\(([a-z\-\.,]+)\))?(!)?: ([0-9a-z\-\., <>()\[\]]{4,})$
would enforce all lowercase Conventional Commit with subject being at least 4 characters long.
Regular expression. (\r\n.+){2}
would require body to be at least two lines long
$ npm install
$ npm run build && npm run package