Skip to content

Commit 9d60c37

Browse files
committed
feat(inputs): add new vars TRIAGE_EVENT_ACTION and TRIAGE_EVENT_NAME
work in preparation for solution 1 . #3
1 parent ace6aa9 commit 9d60c37

File tree

1 file changed

+42
-29
lines changed

1 file changed

+42
-29
lines changed

.github/workflows/project.yaml

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ on:
1010
required: true
1111
description: What project to triage issues/pr for
1212
type: string
13+
TRIAGE_EVENT_ACTION:
14+
required: false
15+
default: "${{ github.event.action }}"
16+
description: Event action that triggered to workflow
17+
type: string
18+
TRIAGE_EVENT_NAME:
19+
required: false
20+
default: "${{ github.event_name }}"
21+
description: Name of event that triggered to workflow
22+
type: string
1323
secrets:
1424
WORKFLOW_TOKEN:
1525
description: Token used to with permission to the project
@@ -32,43 +42,46 @@ jobs:
3242
echo "[Debug] github.event.pull_request.author_association=${{ github.event.pull_request.author_association }}";
3343
echo "[Debug] github.triggering_actor=${{ github.triggering_actor }}";
3444
45+
echo "[Debug] inputs.TRIAGE_EVENT_ACTION=${{ inputs.TRIAGE_EVENT_ACTION }}";
46+
echo "[Debug] inputs.TRIAGE_EVENT_NAME=${{ inputs.TRIAGE_EVENT_NAME }}";
47+
3548
3649
project-add:
3750
name: Add
3851
if: ${{(
3952
(
40-
github.event_name == 'issues'
53+
inputs.TRIAGE_EVENT_NAME == 'issues'
4154
&&
4255
(
43-
github.event.action == 'opened'
56+
inputs.TRIAGE_EVENT_ACTION == 'opened'
4457
||
45-
github.event.action == 'reopened'
58+
inputs.TRIAGE_EVENT_ACTION == 'reopened'
4659
||
47-
github.event.action == 'labeled'
60+
inputs.TRIAGE_EVENT_ACTION == 'labeled'
4861
||
49-
github.event.action == 'milestoned'
62+
inputs.TRIAGE_EVENT_ACTION == 'milestoned'
5063
||
51-
github.event.action == 'demilestoned'
64+
inputs.TRIAGE_EVENT_ACTION == 'demilestoned'
5265
||
53-
github.event.action == 'closed'
66+
inputs.TRIAGE_EVENT_ACTION == 'closed'
5467
||
55-
github.event.action == 'assigned'
68+
inputs.TRIAGE_EVENT_ACTION == 'assigned'
5669
)
5770
)
5871
||
5972
(
60-
github.event_name == 'pull_request'
73+
inputs.TRIAGE_EVENT_NAME == 'pull_request'
6174
&&
6275
(
63-
github.event.action == 'opened'
76+
inputs.TRIAGE_EVENT_ACTION == 'opened'
6477
||
65-
github.event.action == 'edited'
78+
inputs.TRIAGE_EVENT_ACTION == 'edited'
6679
||
67-
github.event.action == 'assigned'
80+
inputs.TRIAGE_EVENT_ACTION == 'assigned'
6881
||
69-
github.event.action == 'reopened'
82+
inputs.TRIAGE_EVENT_ACTION == 'reopened'
7083
||
71-
github.event.action == 'closed'
84+
inputs.TRIAGE_EVENT_ACTION == 'closed'
7285
)
7386
)
7487
)}}
@@ -85,7 +98,7 @@ jobs:
8598
project-remove:
8699
name: Remove
87100
if: ${{(
88-
github.event_name == 'issues' && github.event.action == 'transferred'
101+
inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION == 'transferred'
89102
)}}
90103
runs-on: ubuntu-latest
91104
steps:
@@ -99,9 +112,9 @@ jobs:
99112
project-fields:
100113
name: Field Values
101114
if: ${{(
102-
(github.event_name == 'issues' && github.event.action != 'transferred')
115+
(inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION != 'transferred')
103116
||
104-
(github.event_name == 'pull_request')
117+
(inputs.TRIAGE_EVENT_NAME == 'pull_request')
105118
)}}
106119
needs:
107120
- project-add
@@ -155,9 +168,9 @@ jobs:
155168
name: Set Start Date
156169
if: ${{(
157170
(
158-
(github.event_name == 'issues' && github.event.action == 'assigned')
171+
(inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION == 'assigned')
159172
||
160-
github.event_name == 'pull_request'
173+
inputs.TRIAGE_EVENT_NAME == 'pull_request'
161174
)
162175
&&
163176
needs.project-fields.outputs.project-start-date == ''
@@ -193,7 +206,7 @@ jobs:
193206

194207

195208
- name: Set Status Planning
196-
if: ${{ github.event_name == 'issues' && github.event.action == 'milestoned' }}
209+
if: ${{ inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION == 'milestoned' }}
197210
uses: EndBug/project-fields@v2
198211
with:
199212
operation: set
@@ -205,9 +218,9 @@ jobs:
205218

206219
- name: Set Status In Progress
207220
if: ${{(
208-
(github.event_name == 'issues' && github.event.action == 'assigned')
221+
(inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION == 'assigned')
209222
||
210-
github.event_name == 'pull_request' && github.event.action != 'closed'
223+
inputs.TRIAGE_EVENT_NAME == 'pull_request' && inputs.TRIAGE_EVENT_ACTION != 'closed'
211224
)}}
212225
uses: EndBug/project-fields@v2
213226
with:
@@ -219,7 +232,7 @@ jobs:
219232

220233

221234
- name: Set Status done
222-
if: ${{ github.event.action == 'closed' }}
235+
if: ${{ inputs.TRIAGE_EVENT_ACTION == 'closed' }}
223236
uses: EndBug/project-fields@v2
224237
with:
225238
operation: set
@@ -232,9 +245,9 @@ jobs:
232245
- name: Clear Status
233246
if: ${{(
234247
(
235-
(github.event_name == 'issues' && github.event.action == 'reopened')
248+
(inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION == 'reopened')
236249
||
237-
(github.event_name == 'issues' && github.event.action == 'demilestoned')
250+
(inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION == 'demilestoned')
238251
)
239252
&&
240253
needs.project_fields.project-status != 'Ready to Commence'
@@ -254,9 +267,9 @@ jobs:
254267
needs.project-fields.outputs.project-start-date != ''
255268
&&
256269
(
257-
github.event.action == 'closed'
270+
inputs.TRIAGE_EVENT_ACTION == 'closed'
258271
||
259-
github.event.action == 'reopened'
272+
inputs.TRIAGE_EVENT_ACTION == 'reopened'
260273
)
261274
)}}
262275
needs:
@@ -267,7 +280,7 @@ jobs:
267280

268281
- name: Set End date
269282
if: ${{(
270-
github.event.action == 'closed'
283+
inputs.TRIAGE_EVENT_ACTION == 'closed'
271284
&&
272285
needs.project-fields.outputs.project-end-date == ''
273286
)}}
@@ -282,7 +295,7 @@ jobs:
282295

283296
- name: Clear End Date
284297
if: ${{(
285-
github.event_name == 'issues' && github.event.action == 'reopened'
298+
inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION == 'reopened'
286299
)}}
287300
uses: EndBug/project-fields@v2
288301
with:

0 commit comments

Comments
 (0)