Skip to content

Commit bccb485

Browse files
committed
Added Github Actions workflow to enforce PR template
1 parent 832b2dd commit bccb485

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Enforce PR Template
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, edited]
6+
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
validate-pr-body:
12+
runs-on: ubuntu-latest
13+
# Triggers only if the PR body DOES NOT contain the exact string
14+
if: |
15+
!contains(github.event.pull_request.body, '# Pull Request Checklist')
16+
steps:
17+
- name: Close Invalid Pull Requests
18+
run: |
19+
gh pr close "$PR_NUMBER" --comment "$COMMENT"
20+
env:
21+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
GH_REPO: ${{ github.repository }}
23+
PR_NUMBER: ${{ github.event.pull_request.number }}
24+
COMMENT: >
25+
❌ This pull request has been automatically closed because the mandatory PR template was removed or not filled out. Please reopen or recreate this PR with the required information.

0 commit comments

Comments
 (0)