-
Notifications
You must be signed in to change notification settings - Fork 26
executable file
·49 lines (47 loc) · 1.78 KB
/
pr_verify_linked_issue.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Verify PR
on:
pull_request:
types: [edited, synchronize, opened, reopened]
branches:
- development
check_run:
jobs:
verify_linked_issue:
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
name: Ensure Pull Request has a linked issue.
steps:
- name: Verify Linked Issue
id: verify_linked_issues
uses: Codeinwp/verify-linked-issue-action@master
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
with:
quiet: "true"
- name: Find Comment
uses: peter-evans/find-comment@v1
id: find_coomment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "pirate-bot"
body-includes: No Linked Issue found
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v1
if: steps.verify_linked_issues.outputs.has_linked_issues != 'true'
with:
comment-id: ${{ steps.find_coomment.outputs.comment-id }}
token: ${{ secrets.BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
:guardsman: PR Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>
edit-mode: replace
- name: Fail action on no issue found
if: steps.verify_linked_issues.outputs.has_linked_issues == 'false'
run: exit 1;
- name: Delete comment
uses: winterjung/comment@v1
if: steps.verify_linked_issues.outputs.has_linked_issues == 'true' && steps.find_coomment.outputs.comment-id != ''
with:
type: delete
comment_id: ${{ steps.find_coomment.outputs.comment-id }}
token: ${{ secrets.BOT_TOKEN }}