-
Notifications
You must be signed in to change notification settings - Fork 43
135 lines (131 loc) · 3.99 KB
/
comment-triggers.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Comment commands
on:
pull_request:
types: [opened]
issue_comment:
types: [created]
jobs:
check_user_permission:
runs-on: ubuntu-latest
name: A job to check user's permission level
steps:
- name: Check user permission (write)
id: check-write
uses: actions-cool/check-user-permission@v2
with:
require: 'write'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Abort
if: steps.check-write.outputs.check-result == 'false'
run: exit 1
mythx_partial:
needs: [check_user_permission]
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request }}
outputs:
run: ${{ steps.check.outputs.triggered }}
mode: ${{ steps.mode.outputs.mode }}
steps:
- uses: khan/[email protected]
id: check
with:
trigger: '/mythx partial'
prefix_only: true
reaction: rocket
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- name: Get mode
id: mode
run: |
mode=$(echo "$BODY" | sed "s|/mythx partial ||" | sed "s/ //")
echo "mode=$mode" >> $GITHUB_OUTPUT
env:
BODY: ${{ github.event.comment.body }}
mythx_partial_run:
needs: ['mythx_partial']
if: needs.mythx_partial.outputs.run == 'true'
uses: './.github/workflows/mythx-changed.yml'
with:
pr_number: ${{ github.event.issue.number }}
mode: ${{ needs.mythx_partial.outputs.mode }}
secrets: inherit
mythx_full:
needs: [check_user_permission]
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request }}
outputs:
run: ${{ steps.check.outputs.triggered }}
mode: ${{ steps.mode.outputs.mode }}
steps:
- uses: khan/[email protected]
id: check
with:
trigger: '/mythx full'
prefix_only: true
reaction: rocket
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- name: Get mode
id: mode
run: |
mode=$(echo "$BODY" | sed "s|/mythx full ||" | sed "s/ //")
echo "mode=$mode" >> $GITHUB_OUTPUT
env:
BODY: ${{ github.event.comment.body }}
mythx_full_run:
needs: ['mythx_full']
if: needs.mythx_full.outputs.run == 'true'
uses: './.github/workflows/mythx-full.yml'
with:
mode: ${{ needs.mythx_full.outputs.mode }}
secrets: inherit
release_label:
needs: [check_user_permission]
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request }}
steps:
- uses: khan/[email protected]
id: check
with:
trigger: '/release'
prefix_only: true
reaction: rocket
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- name: Get type
id: type
run: |
type=$(echo "$BODY" | sed "s|/release ||" | sed "s/ //")
echo "type=$type" >> $GITHUB_OUTPUT
env:
BODY: ${{ github.event.comment.body }}
- name: add label
if: steps.check.outputs.triggered == 'true'
uses: actions-ecosystem/action-add-labels@v1
with:
labels: release:${{ steps.type.outputs.type }}
subgraph_label:
needs: [check_user_permission]
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request }}
steps:
- uses: khan/[email protected]
id: check
with:
trigger: '/subgraph'
prefix_only: true
reaction: rocket
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- name: Get type
id: type
run: |
type=$(echo "$BODY" | sed "s|/subgraph ||" | sed "s/ //")
echo "type=$type" >> $GITHUB_OUTPUT
env:
BODY: ${{ github.event.comment.body }}
- name: add label
if: steps.check.outputs.triggered == 'true'
uses: actions-ecosystem/action-add-labels@v1
with:
labels: subgraph:${{ steps.type.outputs.type }}