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

Commit 6a7f959

Browse files
committed
add validation step
1 parent adc2010 commit 6a7f959

5 files changed

Lines changed: 108 additions & 9 deletions

File tree

config.yml

Lines changed: 83 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,89 @@ steps:
197197
position: 35
198198

199199
# 8
200-
# - title: Trigger your first step with a GitHub event
201-
# description: Trigger your first step with a GitHub event
202-
# event: pull_request.synchronize
203-
# actions:
204-
# - type: respond
205-
# with: respond
206-
# 9. Respond to a learner's pull request
207-
# 10. Validate a learner's pull request
200+
- title: Trigger your first step with a GitHub event
201+
description: Trigger your first step with a GitHub event
202+
event: pull_request.synchronize
203+
actions:
204+
- type: respond
205+
with: respond-to-pr.md
206+
- type: octokit
207+
method: pullRequests.createComment
208+
owner: '%payload.repository.owner.login%'
209+
repo: '%payload.repository.name%'
210+
number: '%payload.number%'
211+
commit_id: '%payload.pull_request.head.sha%'
212+
path: config.yml
213+
body: |
214+
```suggestion
215+
event: pull_request.opened
216+
```
217+
position: 35
218+
219+
# 9
220+
- title: Respond to a learner's pull request
221+
description: Respond to a learner's pull request
222+
event: pull_request.synchronize
223+
actions:
224+
- type: respond
225+
with: validate.md
226+
- type: octokit
227+
method: pullRequests.createComment
228+
owner: '%payload.repository.owner.login%'
229+
repo: '%payload.repository.name%'
230+
number: '%payload.number%'
231+
commit_id: '%payload.pull_request.head.sha%'
232+
path: config.yml
233+
body: |
234+
```suggestion
235+
- type: gate
236+
```
237+
position: 40
238+
239+
# 10
240+
- title: Validate a learner's pull request
241+
description: Validate a learner's pull request
242+
event: pull_request.synchronize
243+
actions:
244+
- type: respond
245+
with: add-context.md
246+
- type: octokit
247+
method: pullRequests.createComment
248+
owner: '%payload.repository.owner.login%'
249+
repo: '%payload.repository.name%'
250+
number: '%payload.number%'
251+
commit_id: '%payload.pull_request.head.sha%'
252+
path: config.yml
253+
body: |
254+
```suggestion
255+
left: '%payload.pull_request.title%'
256+
```
257+
position: 41
258+
- type: octokit
259+
method: pullRequests.createComment
260+
owner: '%payload.repository.owner.login%'
261+
repo: '%payload.repository.name%'
262+
number: '%payload.number%'
263+
commit_id: '%payload.pull_request.head.sha%'
264+
path: config.yml
265+
body: |
266+
```suggestion
267+
operator: ===
268+
```
269+
position: 42
270+
- type: octokit
271+
method: pullRequests.createComment
272+
owner: '%payload.repository.owner.login%'
273+
repo: '%payload.repository.name%'
274+
number: '%payload.number%'
275+
commit_id: '%payload.pull_request.head.sha%'
276+
path: config.yml
277+
body: |
278+
```suggestion
279+
right: Add name to README
280+
```
281+
position: 43
282+
208283
# 11. Pass contextual information to a response
209284
# 12. Add some descriptions to your course
210285
# 13. Add a README to your course

responses/add-context.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
We need to validate against the learner's pull request title. This information is accessible to us because it is a pull request that triggered this step's execution (specifically, a `pull_request.opened` event).
2+
3+
We'll add the `left:` option to the gate, and set it to the pull request's title.
4+
5+
Activity:
6+
1. Add a `left:` option to the gate
7+
1. Set the gate's `left:` option to the pull request's title which is `'%payload.pull_request.title%'`.
8+
1. Set the gate's `operator:` to `===`
9+
1. Set the gate's `right:` to the title we expect which is `Add name to README`
10+
11+
You can also accept the suggested changes below. They're in batch, so you'll have to go to Files Changed.

responses/add-response.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ Great, we referenced a file title `welcome-text.md`, but it doesn't exist. Learn
33
Activity: add a response
44

55
1. In the `/responses/` folder, create a new file titled `welcome-text.md`
6-
1. In that file, add some content that will appear to the learner in the welcome issue.
6+
1. In that file, add some content that will appear to the learner in the welcome issue.
7+
1. Add an instruction for the learner to open a new PR titled "Add name to README" in which they add their name to the README file.

responses/respond-to-pr.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
You'll now respond to a new PR!
2+
3+
Activity:
4+
1. In the same step, add a respond action.
5+
1. Add the response file.

responses/validate.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Let's now validate the learner's PR. We asked them to title the PR "Add name to README" so that's what we need to validate against.
2+
3+
The action that will help us validate the learner's PR is a `gate`. Gates are conditionals, and they behave much like a conditional in Javascript. Let's add a `gate`, we'll specify its options in a later step.
4+
5+
Activity: add a gate
6+
7+
1. Add a gate or accept the suggested change below.

0 commit comments

Comments
 (0)