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

Commit 22a45fd

Browse files
Merge pull request #7 from githubtraining/matt-revisions
Revise response content
2 parents 5832e04 + 426d836 commit 22a45fd

31 files changed

+500
-290
lines changed

config.yml

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,27 @@ template:
88
name: "writing-javascript-actions"
99
before:
1010
- type: updateBranchProtection
11+
- type: createLabel
12+
name: first-joke
13+
color: FFBD33
14+
- type: createLabel
15+
name: second-joke
16+
color: 33FFBD
17+
- type: createLabel
18+
name: third-joke
19+
color: 3F8A99
1120
- type: createIssue
1221
title: Start here!
1322
body: 01_welcome-issue.md
1423
action_id: welcomeIssue
1524
- type: respond
16-
issue: '%actions.welcomeIssue.data.number%'
25+
issue: "%actions.welcomeIssue.data.number%"
1726
with: 01_welcome-activity.md
1827
data:
19-
quicklink: '%payload.repository.html_url%/new/master?filename=.github/workflows/my-workflow.yml&workflow_template=blank'
28+
quicklink: "%payload.repository.html_url%/new/master?filename=.github/workflows/my-workflow.yml&workflow_template=blank"
2029
actionsUrl: "%payload.repository.html_url%/actions/new"
2130
steps:
22-
- title: Prepare the repository
31+
- title: Setup a workflow file
2332
description: Create a pull request to add a workflow
2433
event: pull_request
2534
link: "{{ repoUrl }}/issues/1"
@@ -33,18 +42,18 @@ steps:
3342
- left: "%payload.action%"
3443
operator: ===
3544
right: edited
36-
# AND the pull request title equals 'Initial workflow'
45+
# AND the pull request title equals 'Create my-workflow.yml'
3746
- type: gate
3847
left: "%payload.pull_request.title%"
3948
operator: ===
40-
right: Initial workflow
49+
right: Create my-workflow.yml
4150

4251
# if those statments FAIL... do this
4352
else:
4453
- type: respond
4554
with: e-rename-pr.md
4655
data:
47-
title: Initial workflow
56+
title: Create my-workflow.yml
4857
# if those gates === true Then do this stuff
4958
- type: closeIssue
5059
issue: Start here!
@@ -66,17 +75,23 @@ steps:
6675
left: "%payload.check_suite.app.name%"
6776
operator: ===
6877
right: "GitHub Actions"
78+
else:
79+
- type: respond
80+
issue: Initial workflow
81+
with: debug.md
82+
data:
83+
debug: "%payload%"
6984
- type: respond
7085
with: 02_workflow-results.md
71-
issue: Initial workflow
86+
issue: Create my-workflow.yml
7287
data:
7388
actionsUrl: "%payload.repository.html_url%/actions"
7489
- type: getPullRequest
75-
pullRequest: Initial workflow
90+
pullRequest: Create my-workflow.yml
7691
action_id: iwPr
7792
- type: respond
7893
with: 02_modify-workflow.md
79-
issue: Initial workflow
94+
issue: Create my-workflow.yml
8095
data:
8196
workflowFile: "%payload.repository.html_url%/edit/%actions.iwPr.data.head.ref%/.github/workflows/my-workflow.yml"
8297

@@ -86,7 +101,7 @@ steps:
86101
link: "{{ repoUrl }}/pull/2"
87102
actions:
88103
- type: getPullRequest
89-
pullRequest: Initial workflow
104+
pullRequest: Create my-workflow.yml
90105
action_id: workflowPr
91106
- type: respond
92107
with: 03_reference-actions.md
@@ -98,15 +113,15 @@ steps:
98113
event: pull_request.synchronize
99114
actions:
100115
- type: createIssue
101-
title: Setting up your development environment
116+
title: Your first JavaScript action
102117
body: dev-env.md
103118
action_id: devEnv
104119
- type: createReview
105120
event: APPROVE
106121
body: 04_on-to-actions.md
107122
data:
108123
issueUrl: "%actions.devEnv.data.html_url%"
109-
pullRequest: Initial workflow
124+
pullRequest: Create my-workflow.yml
110125
- type: mergePullRequest
111126

112127
- title: Creating the Action metadata
@@ -124,18 +139,23 @@ steps:
124139
right: true
125140
- type: createPullRequest
126141
title: Hello Action
127-
body: 05_explain-metadata.md
142+
body: 05_explain-actions.md
128143
head: hello-world
129144
action_id: helloPr
130145
data:
131146
actionsUrl: "%payload.repository.html_url%/actions"
132147
- type: respond
133148
with: 05_hello-pr.md
134-
issue: Setting up your development environment
149+
issue: Your first JavaScript action
135150
data:
136151
pullUrl: "%actions.helloPr.data.html_url%"
137152
- type: closeIssue
138-
issue: Setting up your development environment
153+
issue: Your first JavaScript action
154+
- type: respond
155+
with: 05_explain-metadata.md
156+
issue: Hello Action
157+
data:
158+
actionsUrl: "%payload.repository.html_url%/actions"
139159
- type: respond
140160
with: 05_create-metadata.md
141161
issue: Hello Action
@@ -216,7 +236,7 @@ steps:
216236
- left: "%payload.action%"
217237
operator: ===
218238
right: edited
219-
# AND the pull request title equals 'Initial workflow'
239+
# AND the pull request title equals 'Create my-workflow.yml'
220240
- type: gate
221241
left: "%payload.pull_request.title%"
222242
operator: ===
@@ -317,7 +337,7 @@ steps:
317337
- left: "%payload.action%"
318338
operator: ===
319339
right: edited
320-
# AND the pull request title equals 'Initial workflow'
340+
# AND the pull request title equals 'Create my-workflow.yml'
321341
- type: gate
322342
left: "%payload.pull_request.title%"
323343
operator: ===

course-details.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,15 @@
22

33
Over the duration of this course, approximately 1 hour, you will learn the skills needed to begin using and customizing GitHub Actions in your unique workflow scenarios.
44

5-
**prerequisites**
6-
It would be very beneficial to you to have JavaScript or other programming familiarity before enrolling in this course.
5+
**Prerequisites**
6+
7+
We will be using Node.js to build our action and GitHub to consume our action. This presents us with a hybrid environment, the Node.js runtime environment and the virtual machine used by GitHub Actions, that you may not be used to if you've taken other Learning Lab courses.
8+
9+
Before we can get started there are a few things you need to setup on your **local machine**
10+
11+
1. Install [Node.js](https://nodejs.org/en/) for your operating system.
12+
2. Ensure you have a text editor installed. I'll be using Visual Studio Code, and although you are free to use your editor of choice you should be aware that using a different editor will result in your screen not matching my examples. Here are some editor options for you:
13+
1. [Visual Studio Code](https://code.visualstudio.com/) **(recommended)**
14+
2. [Atom](https://atom.io/)
15+
3. [Sublime Text](https://www.sublimetext.com/)
16+
3. Lastly, you're going to need a local installation of [Git](https://git-scm.com/) so that you can interact with this repository as you write code.

responses/01_explain-environment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ When a repository is configured with a **workflow** file, like we just created,
2323

2424
1. Your GitHub repository listens for an event
2525
2. That event triggers a workflow run which starts a runner
26-
3. The runner, regardless of the hosting method, is responsible for carrying out the jobs which are defined.
26+
3. The runner, regardless of the hosting method, is responsible for carrying out the jobs which are defined
2727
4. A job is series of steps, which can be actions or commands
28-
5. When the steps complete a report is generated and can be viewed by anyone with access to the repository.
28+
5. When the steps complete a report is generated and can be viewed by anyone with access to the repository
2929

3030

3131

responses/01_explain-syntax.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Go on... Tell me more!
22

3-
I'm glad you asked. Let's take a look at the workflow file that we just committed to this repository.
3+
I'm glad you asked. Let's take a look at the workflow file that we just committed to this repository.
44

55
```yaml
66
name: CI
@@ -9,47 +9,46 @@ on: [push]
99

1010
jobs:
1111
build:
12-
1312
runs-on: ubuntu-latest
1413

1514
steps:
16-
- uses: actions/checkout@v1
17-
- name: Run a one-line script
18-
run: echo Hello, world!
19-
- name: Run a multi-line script
20-
run: |
21-
echo Add other actions to build,
22-
echo test, and deploy your project.
15+
- uses: actions/checkout@v1
16+
- name: Run a one-line script
17+
run: echo Hello, world!
18+
- name: Run a multi-line script
19+
run: |
20+
echo Add other actions to build,
21+
echo test, and deploy your project.
2322
```
2423
2524
This file is made up of a series of metadata, as well as behaviors that we wish to happen when the workflow is triggered.
2625
2726
Let's take a second to talk about each of the pieces that we see here:
2827
2928
- `name: CI`
30-
- This is the user-defined name for the workflow. This shows up on the Actions tab so we can see which workflows, and their statuses, run on this repository.
31-
- ![](https://i.imgur.com/KIFh6kk.png)
29+
- This is the user-defined name for the workflow. This shows up on the Actions tab so we can see which workflows, and their statuses, run on this repository.
3230
- As you can see, our's is currently named `CI`
3331
- `on: [push]`
34-
- This defines the **event** that will tigger a workflow on this repository. Currently we are listening for any [push event](https://developer.github.com/v3/activity/events/types/#pushevent) that happens within this repository.
32+
- This defines the **event** that will tigger a workflow on this repository. Currently we are listening for any [push event](https://developer.github.com/v3/activity/events/types/#pushevent) that happens within this repository.
3533
- Also note that this is an array, which means we can trigger this workflow [on more than one event](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#about-workflow-events) if that is our intended behavior.
3634
- `Jobs:`
37-
- This is our first block of instructions. We are defining our first job for this workflow.
35+
- This is our first block of instructions. We are defining our first job for this workflow.
3836
- In this case, the job has been named `build`
3937
- We also define the runner for the job as `runs-on: ubuntu-latest`
40-
- Finally we define the steps for this job which can either rely on specific actions, or run commands directly. As we can see there are three steps which show a mixed usage of actions and commands.
38+
- Finally we define the steps for this job which can either rely on specific actions, or run commands directly. As we can see there are three steps which show a mixed usage of actions and commands.
4139
- `uses: actions/checkout@v1`
4240
- ```
4341
name: Run a one-line script
4442
run: echo Hello, world!
43+
```
4544
- ```
4645
name: Run a multi-line script
4746
run: |
4847
echo Add other actions to build,
4948
echo test, and deploy your project.
50-
```
49+
```
5150

5251
---
5352

53+
📖Take a deeper dive into [workflow components](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-workflows)
5454
📖Read more about [configuring workflows](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-workflows)
55-

responses/01_explain-workflow.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
## Workflow success!
1+
## While we wait!
22

3-
Great job adding the workflow. Adding that file to this branch is enough for GitHub Actions to begin running on your repository. The time this takes will vary based on the complexity of the workflow. While this runs I'll briefly explain the components of the workflow you just added.
3+
Great job adding the workflow. Adding that file to this branch is enough for GitHub Actions to begin running on your repository. The time this takes will vary based on the complexity of the workflow. While this runs I'll briefly explain the components of the workflow you just added.
44

5-
📖Take a deeper dive into [workflow components](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-workflows)
6-
7-
8-
9-
I'll respond when GitHub Actions finishes running the workflow. You can follow along in the [Actions tab]({{ actionsUrl }}), or by clicking **Details** on the pending status below.
5+
If you want to inspect your running workflow you can do so by heading over to the [Actions tab]({{actionsUrl}}) of this repository.
106

117
---
128

@@ -21,4 +17,4 @@ If the checks don't appear or if the checks are stuck in progress, there's a few
2117
- Refresh the page, it's possible the workflow ran and the page just hasn't been updated with that change
2218
- Try making a commit on this branch. Our workflow is triggered with a `push` event, and committing to this branch will result in a new `push`
2319
- Edit the workflow file on GitHub and ensure there are no red lines indicating a syntax problem
24-
</details>
20+
</details>

responses/01_welcome-activity.md

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,35 @@
1-
### :keyboard: Activity: Create a pull request to prepare the repository
1+
## Configuring a workflow
2+
3+
Actions are enabled on your repository by default, but we still have to tell our repository to use them. We do this by creating a workflow file in our repository.
4+
5+
A **workflow** file can be thought of as the recipe for automating a task. They house the start to finish instructions, in the form of `jobs` and `steps`, for what should happen based on specific triggers.
6+
7+
Your repository can contain multiple **workflow** files that carry out a wide variety of tasks. It is important to consider this when deciding on a name for your **workflow**. The name you choose should reflect the tasks being performed.
8+
9+
_In our case, we will use this one **workflow** file for many things, which leads us to break this convention for teaching purposes._
10+
11+
📖Read more about [workflows](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-a-workflow#choosing-the-type-of-actions-for-your-workflow)
12+
13+
### :keyboard: Activity: Create a pull request to prepare the repository for actions
214

315
1. Create a new workflow file titled `my-workflow.yml` by using the instructions below, or [this quicklink]({{quicklink}}).
4-
- Go to the [Actions tab]({{ actionsUrl }}).
5-
- Choose the **Set up a workflow yourself** option, located on the top right hand corner of the screen.
6-
- Change the name of the file from `main.yml` to `my-workflow.yml`
7-
1. Commit the workflow to a new branch.
8-
1. Create a pull request titled **Initial workflow**.
16+
- Go to the [Actions tab]({{ actionsUrl }}).
17+
- Choose the **Set up a workflow yourself** option, located on the top right hand corner of the screen.
18+
- Change the name of the file from `main.yml` to `my-workflow.yml`.
19+
1. Commit the workflow to a new branch named `add-initial-workflow`.
20+
1. Create a pull request titled **Create my-workflow.yml**.
21+
1. Supply the pull request body content and click `Create pull request`.
22+
23+
_It is important to place meaningful content into the body of the pull requests you create throughout this course. This repository will stay with you long after you complete the course. It is advisable that you use the body of the pull requests you create as a way to take long lived notes about thing you want to remember._
24+
25+
<details><summary>Suggested body content</summary>
26+
27+
`Workflow files are the recipe for task automation. This is where actions are placed if I want to use them for a task.`
28+
29+
</details>
30+
31+
I'll respond in the new pull request when I detect it has been created.
32+
33+
---
934

10-
I'll respond in the new pull request when I detect it has been created.
35+
If at any point you're expecting a response and don't see one, refresh the page.

0 commit comments

Comments
 (0)