-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Check Conventional Commit PR Title | ||
|
||
on: | ||
pull_request: | ||
types: [opened, edited, reopened] | ||
|
||
jobs: | ||
check-pr-title: | ||
runs-on: ubuntu-latest | ||
env: | ||
PR_TITLE: ${{ github.event.pull_request.title }} | ||
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) | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# Get the list of directory names under ./packages | ||
scopes=$(ls -d ./packages/*/ 2>/dev/null | xargs -n 1 basename | tr '\n' '|' | sed 's/|$//') | ||
|
||
# If no directories found, set a default scope | ||
if [ -z "$scopes" ]; then | ||
scopes="default" | ||
fi | ||
|
||
# Generate the regular expression | ||
regex="^(feat|fix|docs|style|refactor|perf|test|chore|revert|release)(\(($scopes|required)\))?: .+$" | ||
|
||
# Output the generated regex | ||
echo "$regex"; |