Skip to content

Commit 3d68fa9

Browse files
title
1 parent b132597 commit 3d68fa9

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/pr.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: PR Title Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize]
6+
7+
jobs:
8+
check-pr-title:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Check out the repository
13+
uses: actions/checkout@v2
14+
15+
- name: Validate PR title
16+
id: validate
17+
run: |
18+
PR_TITLE=$(jq -r .pull_request.title "$GITHUB_EVENT_PATH")
19+
echo "PR Title: $PR_TITLE"
20+
if [[ ! "$PR_TITLE" =~ ^(feat|fix|docs|style|refactor|test|chore):\ .+ ]]; then
21+
echo "PR title does not match the required pattern."
22+
exit 1
23+
fi
24+
25+
- name: Set status
26+
if: failure()
27+
run: |
28+
gh pr comment ${{ github.event.pull_request.number }} --body "❌ PR title does not match the required pattern. Please use the format: 'type: description' (e.g., 'feat: add new feature')."

0 commit comments

Comments
 (0)