Skip to content

Commit 4a357b8

Browse files
fix(ci): pr title check
1 parent bca7a49 commit 4a357b8

1 file changed

Lines changed: 27 additions & 6 deletions

File tree

.github/workflows/pr-title.yaml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
11
on:
2-
pull_request_target:
3-
types: [opened, edited, reopened, synchronize]
2+
pull_request:
3+
types: [opened, edited, synchronize, reopened]
44

55
jobs:
66
pr-title:
77
runs-on: ubuntu-latest
88
name: Verify PR title
99
steps:
10-
- name: Verify PR title
11-
uses: kubernetes-sigs/kubebuilder-release-tools@v0.4.3
12-
with:
13-
github_token: ${{ secrets.GITHUB_TOKEN }}
10+
- name: Checkout code
11+
uses: actions/checkout@v6.0.2
12+
13+
- name: Verify PR title
14+
env:
15+
TITLE: ${{ github.event.pull_request.title }}
16+
run: |
17+
if [[ -z "$TITLE" ]]; then
18+
echo "Error: PR title cannot be empty."
19+
exit 1
20+
fi
21+
22+
if ! [[ "$TITLE" =~ ^($'\u26A0'|$'\u2728'|$'\U0001F41B'|$'\U0001F4D6'|$'\U0001F680'|$'\U0001F331') ]]; then
23+
echo "Error: Invalid PR title format."
24+
echo "Your PR title must start with one of the following indicators:"
25+
echo "- Breaking change: ⚠ (U+26A0)"
26+
echo "- Non-breaking feature: ✨ (U+2728)"
27+
echo "- Patch fix: 🐛 (U+1F41B)"
28+
echo "- Docs: 📖 (U+1F4D6)"
29+
echo "- Release: 🚀 (U+1F680)"
30+
echo "- Infra/Tests/Other: 🌱 (U+1F331)"
31+
exit 1
32+
fi
33+
34+
echo "PR title is valid: '$TITLE'"

0 commit comments

Comments
 (0)