-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
80 lines (77 loc) · 2.45 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: 'Smart Comment Actions'
description: 'Create, update, delete or find a pull request or issue comment'
inputs:
token:
description: 'GitHub token'
required: true
job_status:
description: Status of previous jobs
required: true
default: '[]'
repository:
description: 'The GitHub repository'
default: ${{ github.repository }}
required: false
type:
description: create|update|delete|find
required: true
body:
description: 'The comment body'
required: false
number:
description: 'The number of the issue or pull request'
required: false
# Update/Append comment input
# Delete comment input
comment_id:
description: 'Comment ID. Required to update or delete the comment'
required: false
# Find comment input
author:
description: 'GitHub user name of the comment author to find a comment .'
required: false
runs:
using: "composite"
steps:
- name: Create a comment
if: ${{ inputs.job_status == 'failure' || inputs.job_status == 'skipped' }}
id: create_comment
env:
GH_TOKEN: ${{ inputs.token }}
REPO: ${{ inputs.repository }}
ACTION_TYPE: "create"
BODY: ${{ inputs.body }}
ISSUE_NUMBER: ${{ inputs.number }}
AUTHOR: ${{ inputs.author }}
run: |
${{ github.action_path }}/script.sh
shell: bash
- name: Find a comment
if: ${{ steps.create_comment.outcome == 'skipped'}} #${{ inputs.job_status != 'failure' || inputs.job_status != 'skipped' }}
id: find_comment
env:
GH_TOKEN: ${{ inputs.token }}
REPO: ${{ inputs.repository }}
ACTION_TYPE: "find"
BODY: ${{ inputs.body }}
ISSUE_NUMBER: ${{ inputs.number }}
COMMENT_ID: ${{ inputs.comment_id }}
SEARCH_TERM: ${{ inputs.body }}
AUTHOR: ${{ inputs.author }}
run: |
${{ github.action_path }}/script.sh
shell: bash
- name: Delete a comment
if: ${{ steps.find_comment.outcome == 'success' && steps.find_comment.outputs.comment_id != 'null' }}
id: delete_comment
env:
GH_TOKEN: ${{ inputs.token }}
REPO: ${{ inputs.repository }}
ACTION_TYPE: "delete"
BODY: ${{ inputs.body }}
ISSUE_NUMBER: ${{ inputs.number }}
AUTHOR: ${{ inputs.author }}
COMMENT_ID: ${{ steps.find_comment.outputs.comment_id }}
run: |
${{ github.action_path }}/script.sh
shell: bash