Skip to content
26 changes: 26 additions & 0 deletions .github/workflows/pr-title-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "PR Title Check"

on:
pull_request:
types: [opened, edited, synchronize, reopened]
Comment thread
coderabbitai[bot] marked this conversation as resolved.

permissions:
pull-requests: read

jobs:
check-title:
runs-on: ubuntu-latest
steps:
- name: Check title prefix
env:
PR_TITLE: ${{ github.event.pull_request.title }}
Comment thread
hupling marked this conversation as resolved.
REGEX: "^(feat|fix|docs)(\(.*\))?:"

Check failure on line 17 in .github/workflows/pr-title-check.yml

View workflow job for this annotation

GitHub Actions / test-actionlint-with-default-settings

could not parse as YAML: found unknown escape character
Comment thread
hupling marked this conversation as resolved.
Outdated
run: |
# The regex checks for line start (^), followed by keywords, and an optional description format
if [[ "$PR_TITLE" =~ $REGEX ]]; then
echo "Success: PR title starts with a valid prefix."
else
echo "Error: PR title must start with 'feat:', 'fix:', or 'docs:'."
echo "Current title: $PR_TITLE"
exit 1
fi
Loading