Skip to content

Commit b00ca82

Browse files
authored
Merge pull request #6 from ShirleyRex/fix/husky-commit-issues
feat: Add workflow to require closing keywords on PRs
2 parents 7b6b684 + 7de5ef5 commit b00ca82

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Require Closing Keyword
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
types: [opened, edited, synchronize, reopened]
8+
9+
jobs:
10+
check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Ensure PR closes an issue
14+
uses: actions/github-script@v7
15+
with:
16+
script: |
17+
const body = context.payload.pull_request.body || '';
18+
const keywordPattern = /(close[sd]?|fix(e[sd])?|resolve[sd]?)\s+((#[0-9]+)|([\w.-]+\/[\w.-]+#\d+))/i;
19+
if (!keywordPattern.test(body)) {
20+
core.setFailed('Add a closing keyword like "Closes #123" to the PR description.');
21+
}

0 commit comments

Comments
 (0)