Skip to content

Commit bd8b809

Browse files
committed
Add a workflow to check for open issue
Signed-off-by: Fanit Kolchina <[email protected]>
1 parent cbc52c1 commit bd8b809

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: PR Checklist
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
check-linked-issues:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Get PR body
16+
id: pr-body
17+
run: |
18+
body="${{ github.event.pull_request.body }}"
19+
echo "body=${body}" >> $GITHUB_OUTPUT
20+
21+
- name: Check for linked issues
22+
id: check-issues
23+
run: |
24+
body="${{ github.event.pull_request.body }}"
25+
if echo "$body" | grep -iE "(closes|fixes|resolves|references|ref|close|fix|resolve) #[0-9]+"; then
26+
echo "has_issue=true" >> $GITHUB_OUTPUT
27+
else
28+
echo "has_issue=false" >> $GITHUB_OUTPUT
29+
fi
30+
31+
- name: Comment if no linked issue
32+
if: steps.check-issues.outputs.has_issue == 'false'
33+
uses: peter-evans/create-or-update-comment@v3
34+
with:
35+
token: ${{ secrets.GITHUB_TOKEN }}
36+
issue-number: ${{ github.event.pull_request.number }}
37+
body: |
38+
Hi @${{ github.event.pull_request.user.login }},
39+
40+
Looks like there is no issue linked in this PR. Please link this PR to an open issue using one of these keywords in the PR description:
41+
- Closes #issue-number
42+
- Fixes #issue-number
43+
- Resolves #issue-number
44+
45+
If there isn't an issue yet, please create one first and then link it to this PR.

0 commit comments

Comments
 (0)