Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

Commit 6ed1a0f

Browse files
Merge pull request #40 from githubtraining/use-store-for-links
Use `store` to track step links
2 parents 4752f86 + 3217478 commit 6ed1a0f

File tree

1 file changed

+35
-26
lines changed

1 file changed

+35
-26
lines changed

config.yml

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ before:
1717
title: There's a bug!
1818
body: 00_bug.md
1919
data:
20-
actionsUrl: "%payload.repository.html_url%/actions/new"
20+
actionsUrl: "{{ payload.repository.html_url }}/actions/new"
21+
store:
22+
first_issue_url: "{{ result.data.html_url }}"
2123

2224
# Repository artifacts
2325
# 1. Issue: There's a bug!
@@ -35,7 +37,7 @@ steps:
3537
- title: Use a templated workflow
3638
description: Create a pull request with a templated workflow
3739
event: pull_request
38-
link: "{{ repoUrl }}/issues/1"
40+
link: "{{ store.first_issue_url }}"
3941
actions:
4042
- type: gate
4143
gates:
@@ -54,6 +56,8 @@ steps:
5456
with: e-rename-pr.md
5557
data:
5658
title: CI for Node
59+
store:
60+
ci_for_node_pr: "{{ payload.pull_request.number }}"
5761
- type: respond
5862
with: 01_explain-template.md
5963
data:
@@ -79,14 +83,16 @@ steps:
7983
body: 01_merge-jest.md
8084
base: "%payload.pull_request.head.ref%"
8185
head: add-jest
86+
store:
87+
second_pr_url: "{{ result.data.html_url }}"
8288

8389
# Step 2
8490
# 1. GitHub sends us a workflow run.
8591
# 1. Bot explains what is happening, and why the page build failed (we don't have a [test script](https://github.com/githubtraining/actions-template/blob/master/package.json#L10))
8692
- title: Run a templated workflow
8793
description: Wait for GitHub to run the templated workflow and report back the results
8894
event: check_suite.completed
89-
link: "{{ repoUrl }}/pull/2"
95+
link: "{{ store.second_pr_url }}"
9096
actions:
9197
- type: gate
9298
left: "%payload.check_suite.app.slug%"
@@ -109,7 +115,7 @@ steps:
109115
- title: Add your first test
110116
description: Add your first test script for CI to pick up
111117
event: pull_request.synchronize
112-
link: "{{ repoUrl }}/pull/2"
118+
link: "{{ store.second_pr_url }}"
113119
actions:
114120
- type: respond
115121
with: 03_wait-for-first-test.md
@@ -128,7 +134,7 @@ steps:
128134
- title: Read an Actions log
129135
description: Tell the bot which test is failing so we can fix it
130136
event: issue_comment.created
131-
link: "{{ repoUrl }}/pull/2"
137+
link: "{{ store.second_pr_url }}"
132138
actions:
133139
- type: gate
134140
left: "/(Initializes with two players)|(Starts the game with a random player)|(Sets the current player to be whoever it is not)/gim"
@@ -139,7 +145,7 @@ steps:
139145
- type: respond
140146
with: e-test-name.md
141147
- type: getPullRequest
142-
pullRequest: CI for Node
148+
pullRequest: "{{ store.ci_for_node_pr }}"
143149
action_id: ciPr
144150
- type: respond
145151
with: 04_read-failed-log.md
@@ -162,7 +168,7 @@ steps:
162168
- title: Fix the test
163169
description: Edit the file that's causing the test to fail
164170
event: check_suite.completed
165-
link: "{{ repoUrl }}/pull/2"
171+
link: "{{ store.second_pr_url }}"
166172
actions:
167173
- type: gate
168174
left: "%payload.check_suite.app.slug%"
@@ -196,7 +202,7 @@ steps:
196202
- title: Share the workflow with the team
197203
description: Merge the pull request containing your first workflow so the entire team can use it
198204
event: pull_request.closed
199-
link: "{{ repoUrl }}/pull/2"
205+
link: "{{ store.second_pr_url }}"
200206
actions:
201207
- type: gate
202208
every: true
@@ -210,7 +216,9 @@ steps:
210216
body: 06_custom-workflow.md
211217
action_id: newIssue
212218
data:
213-
workflowUrl: "%payload.repository.html_url%/edit/master/.github/workflows/node.js.yml"
219+
workflowUrl: "%payload.repository.html_url%/edit/master/.github/workflows/nodejs.yml"
220+
store:
221+
workflow_issue_url: "{{ result.data.html_url }}"
214222
- type: respond
215223
with: 0X_goto.md
216224
data:
@@ -222,7 +230,7 @@ steps:
222230
- title: Create a custom GitHub Actions workflow
223231
description: Edit the existing workflow with new build targets
224232
event: pull_request
225-
link: "{{ repoUrl }}/pull/5"
233+
link: "{{ store.workflow_issue_url }}"
226234
actions:
227235
- type: gate
228236
gates:
@@ -258,15 +266,17 @@ steps:
258266
file: .github/workflows/node.js.yml
259267
body: 07_add-windows.md
260268
data:
261-
fileUrl: "%payload.repository.html_url%/edit/%payload.pull_request.head.ref%/.github/workflows/node.js.yml?pr=/%payload.repository.full_name%/pull/%payload.number%"
269+
fileUrl: "%payload.repository.html_url%/edit/%payload.pull_request.head.ref%/.github/workflows/nodejs.yml?pr=/%payload.repository.full_name%/pull/%payload.number%"
270+
store:
271+
node_version_pr: "{{ payload.pull_request.html_url }}"
262272

263273
# Step 8
264274
# 1. Learner adds Windows to the [matrix os](https://github.com/githubtraining/actions-template/blob/master/.github/workflows/node.js.yml#L9)
265275
# 1. Bot asks learner to add a new job for testing, and separate out the test script into that new job.
266276
- title: Target a Windows environment
267277
description: Edit your workflow file to build for Windows environments
268278
event: pull_request.synchronize
269-
link: "{{ repoUrl }}/pull/5"
279+
link: "{{ store.node_version_pr }}"
270280
actions:
271281
# - type: findInTree
272282
# path: .github/workflows/node.js.yml
@@ -288,7 +298,7 @@ steps:
288298
- title: Use multiple jobs
289299
description: Edit your workflow file to separate build and test jobs
290300
event: pull_request.synchronize
291-
link: "{{ repoUrl }}/pull/5"
301+
link: "{{ store.node_version_pr }}"
292302
actions:
293303
# - type: findInTree
294304
# path: .github/workflows/node.js.yml
@@ -311,7 +321,7 @@ steps:
311321
- title: Run multiple jobs
312322
description: Wait for the result of multiple jobs in your workflow
313323
event: check_suite.completed
314-
link: "{{ repoUrl }}/pull/5"
324+
link: "{{ store.node_version_pr }}"
315325
actions:
316326
- type: gate
317327
left: "%payload.check_suite.app.slug%"
@@ -337,7 +347,7 @@ steps:
337347
- title: Upload a job's build artifacts
338348
description: Use the upload action in your workflow file to save a job's build artifacts
339349
event: pull_request.synchronize
340-
link: "{{ repoUrl }}/pull/5"
350+
link: "{{ store.node_version_pr }}"
341351
actions:
342352
# - type: findInTree
343353
# path: .github/workflows/node.js.yml
@@ -367,7 +377,7 @@ steps:
367377
- title: Download a job's build artifacts
368378
description: Use the download action in your workflow file to access a prior job's build artifacts
369379
event: pull_request.synchronize
370-
link: "{{ repoUrl }}/pull/5"
380+
link: "{{ store.node_version_pr }}"
371381
actions:
372382
# - type: findInTree
373383
# path: .github/workflows/node.js.yml
@@ -386,7 +396,7 @@ steps:
386396
# Step 13
387397
- title: Share the improved CI workflow with the team
388398
description: Merge the pull request with the improved workflow
389-
link: "{{ repoUrl }}/pull/5"
399+
link: "{{ store.node_version_pr }}"
390400
event: pull_request.closed
391401
actions:
392402
- type: gate
@@ -399,17 +409,16 @@ steps:
399409
- type: mergeBranch
400410
head: master
401411
base: team-workflow
402-
- type: getIssue
403-
issue: A workflow for the entire team
404-
action_id: workflow
405412
- type: createPullRequest
406413
title: A custom workflow
407414
body: 13_partial-workflow.md
408415
head: team-workflow
409416
action_id: newPR
410417
data:
411-
workflowIssue: "%actions.workflow.data.html_url%"
418+
workflowIssue: "{{ store.workflow_issue_url }}"
412419
fileUrl: "%payload.repository.html_url%/new/team-workflow/?filename=.github/workflows/approval-workflow.yml"
420+
store:
421+
workflow_pr_url: "{{ result.data.html_url }}"
413422
- type: respond
414423
with: 0X_goto.md
415424
data:
@@ -422,7 +431,7 @@ steps:
422431
# 1. Bot asks the learner to choose an event, explains how those events trigger the workflow
423432
- title: Automate the review process
424433
description: Add a new workflow file to automate the team's review process
425-
link: "{{ repoUrl }}/pull/6"
434+
link: "{{ store.workflow_pr_url }}"
426435
event: pull_request.synchronize
427436
actions:
428437
- type: gate
@@ -443,7 +452,7 @@ steps:
443452
# 1. Bot asks learner to add a job with their own title, explains what that does
444453
- title: Use an action to automate pull request reviews
445454
description: Use the community action in your new workflow
446-
link: "{{ repoUrl }}/pull/6"
455+
link: "{{ store.workflow_pr_url }}"
447456
event: pull_request.synchronize
448457
actions:
449458
- type: gate
@@ -464,7 +473,7 @@ steps:
464473
# 1. Bot asks learner to choose a virtual environment, bot explains environment options and why we'd like to pick a specific one
465474
- title: Create an approval job in your new workflow
466475
description: In your new workflow file, create a new job that'll use the community action
467-
link: "{{ repoUrl }}/pull/6"
476+
link: "{{ store.workflow_pr_url }}"
468477
event: pull_request.synchronize
469478
actions:
470479
- type: gate
@@ -483,7 +492,7 @@ steps:
483492
# 1. Bot points out that branch protections aren't currently in place, asks learner to set branch protections, and approve the PR
484493
- title: Automate approvals
485494
description: Use the community action to automate part of the review approval process
486-
link: "{{ repoUrl }}/pull/6"
495+
link: "{{ store.workflow_pr_url }}"
487496
event:
488497
- pull_request.synchronize
489498
- issue_comment.created
@@ -521,7 +530,7 @@ steps:
521530
# 1. Bot turns on pages build, drops link in the PR, explains to the learner the value on a workflow that enforces team behaviors.
522531
- title: Use branch protections
523532
description: Complete the automated review process by protecting the master branch
524-
link: "{{ repoUrl }}/pull/6"
533+
link: "{{ store.workflow_pr_url }}"
525534
event:
526535
- pull_request_review.submitted
527536
- pull_request.labeled

0 commit comments

Comments
 (0)