chore: add PR title check workflow #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |