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

Commit 5832e04

Browse files
authored
Merge pull request #3 from githubtraining/hectorsector-review
Overall course review
2 parents c487fa3 + 607ed09 commit 5832e04

37 files changed

+209
-208
lines changed

config.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ template:
99
before:
1010
- type: updateBranchProtection
1111
- type: createIssue
12-
title: Start Here!
13-
body: welcome-issue.md
12+
title: Start here!
13+
body: 01_welcome-issue.md
14+
action_id: welcomeIssue
15+
- type: respond
16+
issue: '%actions.welcomeIssue.data.number%'
17+
with: 01_welcome-activity.md
1418
data:
19+
quicklink: '%payload.repository.html_url%/new/master?filename=.github/workflows/my-workflow.yml&workflow_template=blank'
1520
actionsUrl: "%payload.repository.html_url%/actions/new"
1621
steps:
1722
- title: Prepare the repository
@@ -28,21 +33,21 @@ steps:
2833
- left: "%payload.action%"
2934
operator: ===
3035
right: edited
31-
# AND the pull request title equals 'Initial Workflow'
36+
# AND the pull request title equals 'Initial workflow'
3237
- type: gate
3338
left: "%payload.pull_request.title%"
3439
operator: ===
35-
right: Initial Workflow
40+
right: Initial workflow
3641

3742
# if those statments FAIL... do this
3843
else:
3944
- type: respond
4045
with: e-rename-pr.md
4146
data:
42-
title: Initial Workflow
47+
title: Initial workflow
4348
# if those gates === true Then do this stuff
4449
- type: closeIssue
45-
issue: Start Here!
50+
issue: Start here!
4651
- type: respond
4752
with: 01_explain-workflow.md
4853
data:
@@ -63,15 +68,15 @@ steps:
6368
right: "GitHub Actions"
6469
- type: respond
6570
with: 02_workflow-results.md
66-
issue: Initial Workflow
71+
issue: Initial workflow
6772
data:
6873
actionsUrl: "%payload.repository.html_url%/actions"
6974
- type: getPullRequest
70-
pullRequest: Initial Workflow
75+
pullRequest: Initial workflow
7176
action_id: iwPr
7277
- type: respond
7378
with: 02_modify-workflow.md
74-
issue: Initial Workflow
79+
issue: Initial workflow
7580
data:
7681
workflowFile: "%payload.repository.html_url%/edit/%actions.iwPr.data.head.ref%/.github/workflows/my-workflow.yml"
7782

@@ -81,7 +86,7 @@ steps:
8186
link: "{{ repoUrl }}/pull/2"
8287
actions:
8388
- type: getPullRequest
84-
pullRequest: Initial Workflow
89+
pullRequest: Initial workflow
8590
action_id: workflowPr
8691
- type: respond
8792
with: 03_reference-actions.md
@@ -101,7 +106,7 @@ steps:
101106
body: 04_on-to-actions.md
102107
data:
103108
issueUrl: "%actions.devEnv.data.html_url%"
104-
pullRequest: Initial Workflow
109+
pullRequest: Initial workflow
105110
- type: mergePullRequest
106111

107112
- title: Creating the Action metadata
@@ -211,7 +216,7 @@ steps:
211216
- left: "%payload.action%"
212217
operator: ===
213218
right: edited
214-
# AND the pull request title equals 'Initial Workflow'
219+
# AND the pull request title equals 'Initial workflow'
215220
- type: gate
216221
left: "%payload.pull_request.title%"
217222
operator: ===
@@ -312,7 +317,7 @@ steps:
312317
- left: "%payload.action%"
313318
operator: ===
314319
right: edited
315-
# AND the pull request title equals 'Initial Workflow'
320+
# AND the pull request title equals 'Initial workflow'
316321
- type: gate
317322
left: "%payload.pull_request.title%"
318323
operator: ===

responses/01_explain-environment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Anatomy of GitHub Actions
22

3-
GitHub Actions is a unique world that lives alongside your repository. It is one made up of many moving parts and having a general understanding of these parts will help us understand the behavior we are going to program into our Action.
3+
GitHub Actions is a unique world that lives alongside your repository. It is one made up of many moving parts and having a general understanding of these parts will help us understand the behavior we are going to program into our action.
44

55
From 30,000 feet GitHub Actions is made up of the following components, with each component having its own complexities:
66

@@ -24,7 +24,7 @@ When a repository is configured with a **workflow** file, like we just created,
2424
1. Your GitHub repository listens for an event
2525
2. That event triggers a workflow run which starts a runner
2626
3. The runner, regardless of the hosting method, is responsible for carrying out the jobs which are defined.
27-
4. A job is series of steps, which can be Actions or commands
27+
4. A job is series of steps, which can be actions or commands
2828
5. When the steps complete a report is generated and can be viewed by anyone with access to the repository.
2929

3030

responses/01_explain-syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Let's take a second to talk about each of the pieces that we see here:
3737
- This is our first block of instructions. We are defining our first job for this workflow.
3838
- In this case, the job has been named `build`
3939
- 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.
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.
4141
- `uses: actions/checkout@v1`
4242
- ```
4343
name: Run a one-line script

responses/01_welcome-activity.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### :keyboard: Activity: Create a pull request to prepare the repository
2+
3+
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**.
9+
10+
I'll respond in the new pull request when I detect it has been created.
Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,62 @@
11
# Hi there 👋!
22

3-
Hello @{{user.login}}, I'm so excited to teach you how to create your own Actions 😄
3+
Hello @{{user.login}}, I'm so excited to teach you how to create your own GitHub Actions 😄
44

55
### Prerequisites
66

7-
We will be using `Node.js` to build our Action and GitHub to consume our Action. This presents us with a hybrid environment that you may not be used to if you've taken other Learning Lab courses.
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.
88

9-
Before we can get started there are a few things you need to setup on your **Local Machine**
9+
Before we can get started there are a few things you need to setup on your **local machine**
1010

1111
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:
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:
1313
1. [Visual Studio Code](https://code.visualstudio.com/) **(recommended)**
1414
2. [Atom](https://atom.io/)
1515
3. [Sublime Text](https://www.sublimetext.com/)
1616
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.
1717

1818
### Getting started
1919

20-
In this repository we will be diving into the world of GitHub Actions writing! I will guide you through the process of writing a custom GitHub Action using the **JavaScript** programming language.
20+
In this repository we will be diving into the world of writing GitHub Actions! I will guide you through the process of writing a custom GitHub Action using the **JavaScript** programming language.
2121

22-
You may be asking yourself, "what are Actions and is **JavaScript** the only language used to create GitHub Actions?"
22+
You may be asking yourself, "what are actions and is JavaScript the only language used to create GitHub Actions?"
2323

2424
Currently, there are **two** supported ways to create your own GitHub Actions:
2525

26-
- [Docker Container Actions](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-actions#docker-container-actions)
27-
- [JavaScript Actions](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-actions#javascript-actions)
26+
- [Docker container actions](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-actions#docker-container-actions)
27+
- [JavaScript actions](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-actions#javascript-actions)
2828

29-
As you can see we aren't necessarily limited to **JavaScript** even though it is the focal point for this course.
29+
As you can see we aren't necessarily limited to JavaScript even though it is the focal point for this course.
3030

3131

32-
### Creating vs Consuming Actions
32+
### Creating vs consuming actions
3333

34-
Although we are going to focus on creating and consuming a custom Action, in this course we will also be consuming some Actions that have been made public to us. Because your workflows will most likely do the same, I found it important to show you where to look for Actions that already exist.
34+
Although we are going to focus on creating and consuming a custom action, in this course we will also be consuming some actions that have been made public to us. Because your workflows will most likely do the same, I found it important to show you where to look for actions that already exist.
3535

3636
After all, for each time we need to reinvent the wheel for our specific use-case there are a handful of times when we are better off using a wheel that's already made!
3737

38-
- The [GitHub Actions Marketplace](https://github.com/marketplace?type=actions) is the primary place to find open-source Actions that the community has written and released. Your Action, should you choose to release it, could also reside here one day, ready to be consumed by the world!
39-
- The [GitHub Actions Repository](https://github.com/actions) is where you can find Actions that are written by GitHub. We will leverage an Action named "[checkout](https://github.com/actions/checkout)" from this repository as we go through this course. I'll explain more about what it does when we use it!
40-
- Your repositories may also contain **private Actions** and they will most likely be located in the `.github/actions` directory in the root of your repository. **This is the convention we will be using as we learn how to create our own Action.**
38+
- The [GitHub Actions Marketplace](https://github.com/marketplace?type=actions) is the primary place to find open-source actions that the community has written and released. Your action, should you choose to release it, could also reside here one day, ready to be consumed by the world!
39+
- The [GitHub Actions Repository](https://github.com/actions) is where you can find actions that are written by GitHub. We will leverage an action named `[checkout](https://github.com/actions/checkout)` from this repository as we go through this course. I'll explain more about what it does when we use it!
40+
- Your repositories may also contain **private actions** and they will most likely be located in the `.github/actions` directory in the root of your repository. **This is the convention we will be using as we learn how to create our own action.**
4141

42-
### Using Actions and Learning Lab
42+
### Using actions and Learning Lab
4343

44-
In other courses, you may have noticed that some behaviors take me longer to respond to than others. In this course, many of the behaviors will be related to our Actions workflow. Those workflows sometimes take longer to complete, up to several minutes. Don't be concerned if I take a few minutes to respond, or if I respond too quickly. Sometimes, I'll let you know what the workflow will say before it finishes! Please wait for the workflows to finish before moving on to your next step.
44+
In other courses, you may have noticed that some behaviors take me longer to respond to than others. In this course, many of the behaviors we'll see demonstrated will be related to our GitHub Actions workflow. Those workflows sometimes take longer to complete, up to several minutes. Don't be concerned if I take a few minutes to respond, or if I respond too quickly. Sometimes, I'll let you know what the workflow will say before it finishes! Please wait for the workflows to finish before moving on to your next step.
4545

4646
If you aren't already familiar, it may be a good idea to go through the [Introduction to GitHub Learning Lab](https://lab.github.com/githubtraining/introduction-to-github).
4747

4848
## Preparing your repository
4949

50-
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.
50+
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.
5151

5252
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.
5353

5454
These individual steps take one of two forms.
5555
- Run a raw command such as `echo` or `npm install`
56-
- Use an Action such as the one we will be building
56+
- Use an action such as the one we will be building
5757

5858
📖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)
5959

60-
### :keyboard: Activity: Create a pull request to prepare the repository
61-
62-
1. Go to the [Actions tab]({{ actionsUrl }}).
63-
2. Choose the **Set up a workflow yourself** option, located on the top right hand corner of the screen.
64-
3. Change the name of the file from `main.yml` to `my-workflow.yml`
65-
4. Commit the workflow to a new branch.
66-
5. Create a pull request titled **Initial Workflow**.
67-
68-
I'll respond in the new pull request when I detect it has been created.
69-
7060
---
7161

72-
If at any point you're expecting a response and don't see one, refresh the page.
73-
74-
75-
76-
62+
If at any point you're expecting a response and don't see one, refresh the page.

responses/02_explain-steps.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
## Digging into a step
22

3-
As I mentioned earlier, a step is a task that is either an Action or a Command. This can be slightly confusing, so I want to take a little time to ensure I explain it to you before moving on.
3+
As I mentioned earlier, a step is a task that is either an action or a command. This can be slightly confusing, so I want to take a little time to ensure I explain it to you before moving on.
44

55
#### Actions
66

77
Actions are powerful. They are small programs written in either JavaScript or running inside of Docker containers, that add some functionality to your repository.
88

9-
The things you can do with Actions are limited only by your imagination. Want to send a tweet every time you tag a release? What about ordering 🍕just by creating an issue?
9+
The things you can do with actions are limited only by your imagination. Want to send a tweet every time you tag a release? What about ordering 🍕just by creating an issue?
1010

11-
Let's not forget the more practical usage of Actions, testing the source code of a repository or letting your team know that you are out of office 🏝 when they @ mention your name in issues or pull requests.
11+
Let's not forget the more practical usage of actions, testing the source code of a repository or letting your team know that you are out of office 🏝 when they @ mention your name in issues or pull requests.
1212

1313
You can define an action's inputs, outputs, and environment variables to create reusable building blocks for your workflow.
1414

15-
Actions are portable. You are free to publish your Actions to the [Actions Marketplace](https://github.com/marketplace?type=actions) where others can use your creation in their workflows! You can also share actions without publishing them to the marketplace by referencing the repository that contains the Actions code!
15+
Actions are portable. You are free to publish your actions to the [Actions Marketplace](https://github.com/marketplace?type=actions) where others can use your creation in their workflows! You can also share actions without publishing them to the marketplace by referencing the repository that contains the actions code!
1616

1717
Actions can even run commands 😏
1818

1919
📖Learn more [About Actions](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-actions)
2020

2121
#### Commands
2222

23-
Commands are useful in the own respect, but are much more limited than Actions.
23+
Commands are useful in the own respect, but are much more limited than actions.
2424

2525
Think about the tasks you might do from the command line of your local machine. Maybe you run `npm install` to install all of the dependencies for your project before running your unit tests. Maybe you run `docker build` to execute a Dockerfile.
2626

2727
You can accomplish the same set of tasks inside of a workflow but using `run` as a step in your job.
2828

2929
Commands are not easily shareable. There is no central location where you can consume the popular commands used in workflows. You do not have access to fine tuning the inputs, outputs or environment variables.
3030

31-
This does not mean commands offer no value in a workflow, but you should use them wisely and if you find yourself reusing the same commands repeatedly, consider turning them into Actions.
31+
This does not mean commands offer no value in a workflow, but you should use them wisely and if you find yourself reusing the same commands repeatedly, consider turning them into actions.

responses/02_modify-workflow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Edit the current workflow
22

3-
Currently `my-workflow.yml` is not set up correctly for our use-case. It worked great for allowing us to take a high-level look at workflows, but if we want to use our custom Actions there are some changes that we have to make to it.
3+
Currently `my-workflow.yml` is not set up correctly for our use-case. It worked great for allowing us to take a high-level look at workflows, but if we want to use our custom actions there are some changes that we have to make to it.
44

55
### :keyboard: Activity: Modify my-workflow.yml to remove boilerplate steps
66

responses/02_workflow-results.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The right-hand panel shows real-time logging of the steps executed by the `build
1818

1919
GitHub Actions will **always** add the `Set up job` and `Complete job` steps to each job in a workflow. These steps are what configure the [virtual environment](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners) before running your steps and shut it down properly before moving onto the next job in your workflow.
2020

21-
If you recall, we had 1 step that used an Action and 2 steps that ran commands, can you identify which step used the Action?
21+
If you recall, we had 1 step that used an action and 2 steps that ran commands, can you identify which step used the action?
2222

2323
If you said `actions/checkout@v1` you'd be correct 😄!
2424

0 commit comments

Comments
 (0)