-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (48 loc) · 1.72 KB
/
template_merge_block.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
50
51
52
53
54
55
name: Do Not Merge
on:
workflow_call:
inputs:
label:
required: false
type: string
default: "do not merge"
comment:
required: false
type: boolean
default: true
jobs:
do-not-merge:
name: Check
runs-on: ubuntu-24.04
steps:
- name: Find Comment
if: inputs.comment
uses: peter-evans/[email protected]
id: comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: ⚠️ **This Pull Request is not ready to be merged.**
- name: Comment on PR
if: inputs.comment && contains(github.event.pull_request.labels.*.name, inputs.label) && steps.comment.outputs.comment-id == ''
uses: peter-evans/[email protected]
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
⚠️ **This Pull Request is not ready to be merged.**
Remove the label '${{ inputs.label }}' to proceed.
- name: Delete Comment
if: inputs.comment && !contains(github.event.pull_request.labels.*.name, inputs.label) && steps.comment.outputs.comment-id != ''
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: ${{ steps.comment.outputs.comment-id }}
})
- name: Fail if label exists to block merge
if: contains(github.event.pull_request.labels.*.name, inputs.label)
run: |
echo "This PR has the label '${{ inputs.label }}'."
exit 1