Skip to content

refactor: lint GitHub PR title #16

refactor: lint GitHub PR title

refactor: lint GitHub PR title #16

Workflow file for this run

name: pr
on:
pull_request:
types:
- opened
- edited
- synchronize
branches:
- main
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
lint:
name: Lint PR Title
runs-on: ubuntu-24.04
timeout-minutes: 1
steps:
- name: Lint PR Title
run: |
regex="^(fix|feat|refactor|revert|test|perf|style|chore|docs): .*[^.\n]{0,70}$"
if [[ "${PR_TITLE}" =~ $regex ]]; then
echo -e "PR title is valid: ${PR_TITLE}"
else
echo -e "Invalid PR title: ${PR_TITLE}"
echo -e "PR title must match the following pattern: ${regex}"
exit 1
fi
env:
PR_TITLE: ${{ github.event.pull_request.title }}