feat: Add workflow to require closing keywords on PRs #1
Workflow file for this run
This file contains hidden or 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
| name: Require Closing Keyword | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| types: [opened, edited, synchronize, reopened] | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Ensure PR closes an issue | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const body = context.payload.pull_request.body || ''; | |
| const keywordPattern = /(close[sd]?|fix(e[sd])?|resolve[sd]?)\s+((#[0-9]+)|([\w.-]+\/[\w.-]+#\d+))/i; | |
| if (!keywordPattern.test(body)) { | |
| core.setFailed('Add a closing keyword like "Closes #123" to the PR description.'); | |
| } |