This repository has been archived by the owner on Sep 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconfig.yml
370 lines (351 loc) · 13.4 KB
/
config.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
title: Write a Learning Lab course
description: Your Learning Lab course will help developers around the world discover new technologies, learn new skills and build better software. You have knowledge to share and this course will help you take your first steps, today.
template:
name: lab-starter
repo: write-a-ll-course-template
before:
- type: createLabel
name: help
color: ff0000
- type: createLabel
name: "1: Committing a header"
color: 4b0082
- type: createLabel
name: "2: Closing an issue"
color: 0000cd
- type: createLabel
name: "3: Fixing a bug"
color: 40e0d0
- type: createLabel
name: "4: Writing a function"
color: e9967a
# Template:
# Template: commented config, README, course-details.
# Branch `course-planning` for step 1 with a few ideas. User told not to edit the first two.
# Branch `template` for step 4, with comments added to the place where the template repository goes
# Branch `map-events` for step 5, with learning objective for 1 mapped out, and 2 is ready to go with comments
# Branch `first-response` for step 8. After step 7 it gets merged into `map-events`. It has an empty response file for the first step.
# Branch `first-feedback` for step 11. After step 10 it gets merged into `map-events`. It has two empty response files.
# Step 1: Decide what to teach - what's the right step?
# README.md or course-details
# We have suggestions but they can also write their own. Our suggestions are ideas, not solutions. Ex: Introduction to GitHub, Introduction to Markdown
- type: createPullRequest
title: Choose a topic for your course
body: 01_welcome.md
head: course-planning
- type: updateBranchProtection
steps:
- title: Choose a topic for your course
description: Choose what you'd like to teach through Learning Lab, or borrow one of our suggestions for practice.
event: issue_comment.created
link: '{{ repoUrl }}/pull/1'
actions:
# Step 2: Break course into smaller, targeted learning objectives
- type: respond
with: 02_break-it-down.md
data:
url: '%payload.repository.html_url%/edit/course-planning/config.yml?'
- title: Break your course into smaller steps
description: Break down what you'd like to teach into smaller learning objectives.
event: pull_request.synchronize
link: '{{ repoUrl }}/pull/1'
actions:
# Step 3: Merge the pull request
- type: removeBranchProtection
- type: respond
with: 03_merge.md
data:
url: '%payload.repository.html_url%/edit/course-planning/config.yml?'
- title: Merge your learning objectives
description: Merge the pull request breaking down your course topic into smaller learning objectives.
event: pull_request.closed
link: '{{ repoUrl }}/pull/1'
actions:
- type: gate
every: true
gates:
- left: '%payload.action%'
operator: ===
right: closed
- left: '%payload.pull_request.merged%'
- type: respond
with: 03_nice-work.md
# Step 4: Choose a template project
- type: createPullRequest
title: Choose a template project
body: 04_choose-a-template.md
head: template
data:
url: '%payload.repository.html_url%/edit/template/config.yml?'
- type: updateBranchProtection
- title: Reference the template
description: Edit the config file to reference your chosen template repository.
event: pull_request.synchronize
link: '{{ repoUrl }}/pull/2'
actions:
# - type: gate # we validate that the repository exists
- type: getPullRequest
waitForMergeable: true
action_id: pr
- type: gate
left: "%actions.pr.data.mergeable%"
else:
type: respond
with: 04_merge-conflict.md
- type: respond
with: 04_good-template.md
- type: removeBranchProtection
- type: mergeBranch
head: template
- type: mergeBranch
head: main
base: map-events
- type: deleteBranch
branch: template
# Step 5: Mapping learning objectives to events and how to choose events that align with the learning objective
- type: createPullRequest
title: Map learning objectives to events
body: 05_map-events.md
head: map-events
data:
url: '%payload.repository.html_url%/edit/map-events/config.yml?'
- type: updateBranchProtection
- title: Map learning objectives to events
description: Map the learning objectives you wrote to specific events from GitHub webhooks.
event: pull_request.synchronize
link: '{{ repoUrl }}/pull/3'
actions:
# - type: gate # we check if they have events or things that aren't events where events should be
# Step 6: Rough outline of learning objectives as events
- type: respond
with: 06_create-outline.md
data:
url: '%payload.repository.html_url%/edit/map-events/config.yml?'
- title: Create an outline of learning objectives as events
description: Using the same strategy of mapping learning objectives to events, create an outline of events for your course.
event: pull_request.synchronize
link: '{{ repoUrl }}/pull/3'
actions:
# - type: gate we validate that there are actually events
# Step 7: 3 phases of a step
- type: respond
with: 07_3-phases.md
- title: Choose the example that shows the three phases
description: Apply a label that corresponds to the example showing the three phases of a step.
event: pull_request.labeled
link: '{{ repoUrl }}/pull/3'
actions:
#- type: gate check that the correct label was applied - correct labels are 2 "2: Closing an issue" and 3 "3: Fixing a bug"
# else: If user needs help, longer explanation of each example, plus instructions/video of how to add labels
- type: gate
every: true
gates:
- left: '%payload.pull_request.labels.0.name%'
operator: ===
right: "2: Closing an issue"
- left: '%payload.pull_request.labels.1.name%'
operator: ===
right: "3: Fixing a bug"
else:
- type: gate
left: '%payload.pull_request.labels.0.name%'
operator: ===
right: "help"
- type: respond
with: 07_help.md
# Step 8: Pick 1 learning objective and write the phase 1 response
- type: respond
with: 08_first-response.md
data:
url: '%payload.repository.html_url%/edit/map-events/responses/01_first-response.md?'
- type: mergeBranch
base: map-events
head: first-response
- title: Create the first response
description: Write the first response, phase 1, for the first step of your course.
event: pull_request.synchronize
link: '{{ repoUrl }}/pull/3'
actions:
# - type: gate # we validate that it's more than 5 words or something.
- type: getFileContents
filename: 'responses/01_first-response.md'
action_id: contents
- type: gate
left: '/((\w+\s)|(\w+.\s)){4,}\w+/'
operator: test
right: '%actions.contents%'
else:
- type: respond
with: 08_correct-response.md
data:
url: '%payload.repository.html_url%/edit/map-events/responses/01_first-response.md?'
# Step 9: How to give the user the response? ACTIONS in the config
- type: respond
with: 09_first-action.md
data:
url: '%payload.repository.html_url%/edit/map-events/config.yml?'
- title: Write the first Learning Lab action
description: Write the first Learning Lab action for a response into your course's configuration file.
event: pull_request.synchronize
link: '{{ repoUrl }}/pull/3'
actions:
# - type: gate We validate that the proper text is added, with an action response pointing to the right file in the right line of the config.
- type: getFileContents
filename: 'config.yml'
sha: '%payload.pull_request.head.sha%'
action_id: contents
- type: gate
left: '/(type: respond |type: respond)(\n|\r)( |\t)(with: 01_first-response.md)/'
operator: test
right: '%actions.contents%'
else:
- type: respond
with: 09_config-reference.md
data:
url: '%payload.repository.html_url%/edit/map-events/config.yml?'
# Step 10: Phase 2 - checking if the user did it, intro to Gate
- type: respond
with: 10_gate.md
data:
url: '%payload.repository.html_url%/edit/map-events/config.yml?'
- title: Write a gate
description: Write a gate to check the user's first step
event: pull_request.synchronize
link: '{{ repoUrl }}/pull/3'
actions:
# - type: gate We validate it's actually a gate
- type: getFileContents
filename: 'config.yml'
action_id: contents
- type: gate
left: '/(type: gate)(\n|\r)( |\t\t)(left:.+)(\n|\r)( |\t\t)(operator:.+)(\n|\r)( |\t\t)(right:.+)/'
operator: test
right: '%actions.contents%'
else:
- type: respond
with: 10_gate-check.md
data:
url: '%payload.repository.html_url%/edit/map-events/config.yml?'
# Step 11: Phase 3 - feedback, create the response
- type: mergeBranch
base: map-events
head: first-feedback
- type: respond
with: 11_feedback.md
data:
niceUrl: '%payload.repository.html_url%/edit/map-events/responses/01_nice-work.md?'
tryagainUrl: '%payload.repository.html_url%/edit/map-events/responses/01_try-again.md?'
- title: Write feedback for the learner
description: Write feedback into the feedback response for the learner to let them know they've done it right.
event: issue_comment.created
link: '{{ repoUrl }}/pull/3'
actions:
# - type: gate we validate that the correct file was changed, with enough words
- type: getPullRequest
action_id: pull_request
- type: getFileContents
filename: 'responses/01_nice-work.md'
sha: '%actions.pull_request.data.head.sha%'
action_id: contents
- type: gate
left: '/((\w+\s)|(\w+.\s)){4,}\w+/'
operator: test
right: '%actions.contents%'
else:
- type: respond
with: 11_correct-response1.md
data:
url: '%payload.repository.html_url%/edit/map-events/responses/01_nice-work.md?'
- type: getFileContents
filename: 'responses/01_try-again.md'
sha: '%actions.pull_request.data.head.sha%'
action_id: contents
- type: gate
left: '/((\w+\s)|(\w+.\s)){4,}\w+/'
operator: test
right: '%actions.contents%'
else:
- type: respond
with: 11_correct-response2.md
data:
url: '%payload.repository.html_url%/edit/map-events/responses/01_try-again.md?'
# Step 12: Code the response action for phase 3 into the config
- type: respond
with: 12_phase-3-config.md
data:
url: '%payload.repository.html_url%/edit/map-events/config.yml?'
- title: Write the config logic
description: Write the config logic for both responses to the learner in their first step.
event: pull_request.synchronize
link: '{{ repoUrl }}/pull/3'
actions:
# - type: gate we check that they have both responses
- type: getFileContents
filename: 'config.yml'
sha: '%payload.pull_request.head.sha%'
action_id: contents
- type: gate
left: '/(type: respond)(\n|\r)( |\t\t)(with: 01_nice-work.md)/'
operator: test
right: '%actions.contents%'
else:
- type: respond
with: 12_feedback-reference.md
data:
url: '%payload.repository.html_url%/edit/map-events/config.yml?'
# Step 13: Config metadata (title, etc)
- type: respond
with: 13_metadata.md
data:
url: '%payload.repository.html_url%/edit/map-events/config.yml?'
- title: Create course metadata
description: Add the course metadata like title and description to the configuration file.
event: pull_request.synchronize
link: '{{ repoUrl }}/pull/3'
actions:
# - type: gate We validate they committed valid metadata.
- type: getFileContents
filename: 'config.yml'
sha: '%payload.pull_request.head.sha%'
action_id: contents
- type: gate
left: '/(title:.+)(\n|\r)(tagline:.+)*(\n|\r)*(description:)/'
operator: test
right: '%actions.contents%'
else:
- type: respond
with: 13_check-metadata.md
data:
url: '%payload.repository.html_url%/edit/map-events/config.yml?'
# Step 14: Import the course as a draft
- type: createIssue
title: Import the course
body: 14_import-course.md
- type: respond
with: 13_nice-job.md
- type: removeBranchProtection
- type: mergeBranch
head: map-events
- type: respond
with: 14_troubleshooting.md
issue: Import the course
- title: Import the course
description: Import this repository as a course on GitHub Learning Lab.
event: issue_comment.created # should be import ???
link: '{{ repoUrl }}/issues/4'
actions:
# Step 15: Try to take your own course
- type: respond
with: 15_try-it.md
issue: 4
- title: Close the issue
description: To signal that you've tested your course, close this issue.
event: issues.closed
link: '{{ repoUrl }}/issues/4'
actions:
# Step 16: Back to learning objectives/events, create phases 1-3 for additional steps
- type: respond
with: 16_finish-it.md
tags: [
"Courses", "Teaching", "YAML", "Learning Lab", "Learning"
]