Skip to content

Commit 68db8a9

Browse files
authored
fix: add github actions to verify PR name (#24)
1 parent 841ed33 commit 68db8a9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/pr-name.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Pull Request Name
2+
on:
3+
pull_request:
4+
types: [opened, edited, synchronize, reopened]
5+
branches:
6+
- next
7+
8+
jobs:
9+
pull_request_name:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Obtain PR name
13+
run: echo "PR_TITLE=${{ github.event.pull_request.title }}" >> $GITHUB_ENV
14+
- name: Verify PR name
15+
uses: actions/github-script@v6
16+
with:
17+
script: |
18+
if (!/^(fix|feat|perf):/.test(process.env.PR_TITLE)) {
19+
throw new Error(`Please start the PR title with "fix:", "feat:" or "perf:". Current title: "${process.env.PR_TITLE}"`);
20+
}

0 commit comments

Comments
 (0)