-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
40 lines (36 loc) · 1.14 KB
/
action.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
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
name: 'Block with comment'
author: 'Biocatch'
description: 'Will fail and add a comment to a PR'
inputs:
test:
description: 'the test to perform, should be "true" to pass'
required: true
fail-message:
description: 'The message to comment with if the test fails'
required: true
comment_tag:
description: 'The tag to add to the comment'
required: true
runs:
using: "composite"
steps:
- name: send message if test fails in progress
if: ${{ inputs.test != 'true' }}
uses: thollander/actions-comment-pull-request@v2
with:
message: ${{ inputs.fail-message }}
mode: recreate
comment_tag: ${{ inputs.comment_tag }}
- name: forbid merge if test fails
if: ${{ inputs.test != 'true' }}
shell: bash
run: exit 1
- name: delete message if test passed
if: ${{ inputs.test == 'true' }}
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Test passed, comment will be deleted
mode: delete
comment_tag: ${{ inputs.comment_tag }}