Skip to content

chore: add PR title check workflow #1

chore: add PR title check workflow

chore: add PR title check workflow #1

name: Check Conventional Commit PR Title
on:
pull_request:
types: [opened, edited, reopened]
jobs:
check-pr-title:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: amplify-js
- name: Generate Regex and Check PR title
working-directory: ./amplify-js
run: |
regex=$(./scripts/generate-conventional-commit-regex.sh)
pr_title="${{ github.event.pull_request.title }}"
if [[ $pr_title =~ $regex ]]; then
echo "✅ PR title '$pr_title' is valid"
exit 0
else
echo "❌ PR title '$pr_title' is invalid"
echo "It should match the pattern: $regex"
exit 1
fi