Skip to content

Commit 25efefe

Browse files
Update the Skills course for Actions (#74)
* Start updating the course * Remove boilerplate comments * Remove boilerplate comments from readme * More clarifications * More clarifications * Fix typo * Fix typo * Update .github/steps/1-create-a-workflow.md * Update .github/steps/2-add-a-job.md * Update .github/steps/3-add-actions.md Co-authored-by: Felicity Chapman <felicitymay@github.com> * Update .github/steps/5-trigger.md Co-authored-by: Felicity Chapman <felicitymay@github.com> * Update .github/steps/X-finish.md Co-authored-by: Felicity Chapman <felicitymay@github.com> * Update 3-add-actions.md --------- Co-authored-by: Felicity Chapman <felicitymay@github.com>
1 parent ad01114 commit 25efefe

8 files changed

+64
-116
lines changed

.github/steps/0-welcome.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!-- readme -->
1+
<!-- The readme will be displayed. -->

.github/steps/1-create-a-workflow.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
<!--
2-
<<< Author notes: Step 1 >>>
3-
Choose 3-5 steps for your course.
4-
The first step is always the hardest, so pick something easy!
5-
Link to docs.github.com for further explanations.
6-
Encourage users to open new tabs for steps!
7-
-->
8-
91
## Step 1: Create a workflow file
102

113
_Welcome to "Hello GitHub Actions"! :wave:_
@@ -20,24 +12,30 @@ _Welcome to "Hello GitHub Actions"! :wave:_
2012
- To read more about workflows, jobs, and events, see "[Understanding GitHub Actions](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions)".
2113
- If you want to learn more about the `pull_request` event before using it, see "[pull_request](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request)".
2214

23-
To get you started, we used actions to go ahead and made a branch and pull request for you.
15+
To get you started, we ran an Actions workflow in your new repository that, among other things, created a branch for you to work in, called `welcome-workflow`.
2416

2517
### :keyboard: Activity: Create a workflow file
2618

2719
1. Open a new browser tab, and navigate to this same repository. Then, work on the steps in your second tab while you read the instructions in this tab.
28-
1. Create a pull request to view all the changes you'll make throughout this course. Click the **Pull Requests** tab, click **New pull request**, set `base: main` and `compare:welcome-workflow`, click **Create pull request**.
20+
1. Create a pull request. This will contain all of the changes you'll make throughout this part of the course.
21+
22+
Click the **Pull Requests** tab, click **New pull request**, set `base: main` and `compare:welcome-workflow`, click **Create pull request**, then click **Create pull request** again.
23+
2924
1. Navigate to the **Code** tab.
3025
1. From the **main** branch dropdown, click on the **welcome-workflow** branch.
3126
1. Navigate to the `.github/workflows/` folder, then select **Add file** and click on **Create new file**.
32-
1. In the **Name your file...** field, enter `welcome.yml`.
27+
1. In the **Name your file** field, enter `welcome.yml`.
3328
1. Add the following content to the `welcome.yml` file:
34-
```yaml
29+
30+
```yaml copy
3531
name: Post welcome comment
3632
on:
3733
pull_request:
3834
types: [opened]
3935
permissions:
4036
pull-requests: write
4137
```
42-
1. To commit your changes, click **Commit new file**.
43-
1. Wait about 20 seconds for actions to run, then refresh this page (the one you're following instructions from) and an action will automatically close this step and open the next one.
38+
39+
1. To commit your changes, click **Commit changes**.
40+
1. Type a commit message, select **Commit directly to the welcome-workflow branch** and click **Commit changes**.
41+
1. Wait about 20 seconds, then refresh this page (the one you're following instructions from). A separate Actions workflow in the repository (not the workflow you created) will run and will automatically replace this contents of this README file with instructions for the next step.

.github/steps/2-add-a-job.md

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
1-
<!--
2-
<<< Author notes: Step 2 >>>
3-
Start this step by acknowledging the previous step.
4-
Define terms and link to docs.github.com.
5-
Historic note: The previous course had troubleshooting steps for people not using the GitHub UI.
6-
-->
7-
81
## Step 2: Add a job to your workflow file
92

103
_Nice work! :tada: You added a workflow file!_
114

12-
Here's what it means:
5+
Here's what the entries in the `welcome.yml` file, on the `welcome-workflow` branch, mean:
136

14-
- `name: Post welcome comment` gives your workflow a name. This name appears on any pull request or in the Actions tab of your repository.
15-
- `on: pull_request: types: [opened]` indicates that your workflow will execute anytime a pull request opens in your repository.
7+
- `name: Post welcome comment` gives your workflow a name. This name will appear in the Actions tab of your repository.
8+
- `on: pull_request: types: [opened]` indicates that your workflow will execute whenever someone opens a pull request in your repository.
169
- `permissions` assigns the workflow permissions to operate on the repository
1710
- `pull-requests: write` gives the workflow permission to write to pull requests. This is needed to create the welcome comment.
1811

1912
Next, we need to specify jobs to run.
2013

21-
**What is a _job_?**: A job is a set of steps in a workflow that execute on the same runner (a runner is a server that runs your workflows when triggered). Workflows have jobs, and jobs have steps. Steps are executed in order and are dependent on each other. We'll add steps in the next step of this exercise. To read more about jobs, see "[Jobs](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions#jobs)".
14+
**What is a _job_?**: A job is a set of steps in a workflow that execute on the same runner (a runner is a server that runs your workflows when triggered). Workflows have jobs, and jobs have steps. Steps are executed in order and are dependent on each other. You'll add steps to your workflow later in the course. To read more about jobs, see "[Jobs](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions#jobs)".
2215

23-
In this step of our exercise, we will add a "build" job. We will specify `ubuntu-latest` as the fastest and cheapest job runner available. If you want to read more about why we'll use that runner, see the code explanation for the line `runs-on: ubuntu-latest` in the "[Understanding the workflow file](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions#understanding-the-workflow-file)" article.
16+
In the following activity, you'll add a "build" job to your workflow. You'll specify `ubuntu-latest` as the fastest, and cheapest, job runner available. If you want to read more about why we'll use that runner, see the code explanation for the line `runs-on: ubuntu-latest` in the "[Understanding the workflow file](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions#understanding-the-workflow-file)" article.
2417

2518
### :keyboard: Activity: Add a job to your workflow file
2619

27-
1. Open your `welcome.yml` file.
28-
2. Update the contents of the file to:
29-
```yaml
20+
1. In a separate browser tab, make sure you are on the `welcome-workflow` branch and open your `.github/workflows/welcome.yml` file.
21+
1. Edit the file and update its contents to:
22+
23+
```yaml copy
3024
name: Post welcome comment
3125
on:
3226
pull_request:
@@ -38,6 +32,7 @@ In this step of our exercise, we will add a "build" job. We will specify `ubuntu
3832
name: Post welcome comment
3933
runs-on: ubuntu-latest
4034
```
41-
3. Click **Commit changes...** in the top right of the workflow editor.
42-
4. Type your commit message and commit your changes directly to your branch.
43-
5. Wait about 20 seconds for actions to run, then refresh this page (the one you're following instructions from) and an action will automatically close this step and open the next one.
35+
36+
1. Click **Commit changes** in the top right of the workflow editor.
37+
1. Type a commit message and commit your changes directly to the `welcome-workflow` branch.
38+
1. Wait about 20 seconds, then refresh this page (the one you're following instructions from). Another workflow will run and will replace this content with instructions for the next step.

.github/steps/3-add-actions.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
1-
<!--
2-
<<< Author notes: Step 3 >>>
3-
Start this step by acknowledging the previous step.
4-
Define terms and link to docs.github.com.
5-
-->
6-
7-
## Step 3: Add actions to your workflow file
1+
## Step 3: Add a step to your workflow file
82

93
_Nice work adding a job to your workflow! :dancer:_
104

11-
Workflows have jobs, and jobs have steps. So now we'll add steps to your workflow.
5+
Workflows have jobs, and jobs have steps. So now we'll add a step to your workflow.
6+
7+
**What are _steps_?**: Actions steps run - in the order they are specified, from the top down - when a workflow job is processed. Each step must pass for the next step to run.
128

13-
**What are _steps_?**: Actions steps will run during our job in order. Each step is either a shell script that will be executed, or an action that will be run. Each step must pass for the next step to run. Actions steps can be used from within the same repository, from any other public repository, or from a published Docker container image.
9+
Each step consists of either a shell script that's executed, or a reference to an action that's run. When we talk about an action (with a lowercase "a") in this context, we mean a reusable unit of code. You can find out about actions in "[Finding and customizing actions](https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions)," but for now we'll use a shell script in our workflow step.
1410

15-
In our action, we post a comment on the pull request using a [bash](https://en.wikipedia.org/wiki/Bash_%28Unix_shell%29) script and [GitHub CLI](https://cli.github.com/).
11+
Update your workflow to make it post a comment on new pull requests. It will do this using a [bash](https://en.wikipedia.org/wiki/Bash_%28Unix_shell%29) script and [GitHub CLI](https://cli.github.com/).
1612

17-
### :keyboard: Activity: Add Actions steps to your workflow file
13+
### :keyboard: Activity: Add a step to your workflow file
1814

19-
1. Open your `welcome.yml` file.
20-
2. Update the contents of the file to:
21-
```yaml
15+
1. Still working on the `welcome-workflow` branch, open your `welcome.yml` file.
16+
1. Update the contents of the file to:
17+
18+
```yaml copy
2219
name: Post welcome comment
2320
on:
2421
pull_request:
@@ -35,6 +32,9 @@ In our action, we post a comment on the pull request using a [bash](https://en.w
3532
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3633
PR_URL: ${{ github.event.pull_request.html_url }}
3734
```
38-
3. Click **Commit changes...** in the top right of the workflow editor.
39-
4. Type your commit message and commit your changes directly to your branch.
40-
5. Wait about 20 seconds for actions to run, then refresh this page (the one you're following instructions from) and an action will automatically close this step and open the next one.
35+
36+
**Note:** The step you've added uses GitHub CLI (`gh`) to add a comment when a pull request is opened. To allow GitHub CLI to post a comment, we set the `GITHUB_TOKEN` environment variable to the value of the `GITHUB_TOKEN` secret, which is an installation access token, created when the workflow runs. For more information, see "[Automatic token authentication](https://docs.github.com/en/actions/security-guides/automatic-token-authentication)." We set the `PR_URL` environment variable to the URL of the newly created pull request, and we use this in the `gh` command.
37+
38+
1. Click **Commit changes** in the top right of the workflow editor.
39+
1. Type your commit message and commit your changes directly to your branch.
40+
1. Wait about 20 seconds, then refresh this page (the one you're following instructions from). Another workflow will run and will replace this content with instructions for the next step.
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
<!--
2-
<<< Author notes: Step 4 >>>
3-
Start this step by acknowledging the previous step.
4-
Define terms and link to docs.github.com.
5-
-->
6-
71
## Step 4: Merge your workflow file
82

93
_You're now able to write and run an Actions workflow! :sparkles:_
@@ -16,4 +10,4 @@ Merge your changes so the action will be a part of the `main` branch.
1610
1. Click on the pull request you created in step 1.
1711
1. Click **Merge pull request**, then click **Confirm merge**.
1812
1. Optionally, click **Delete branch** to delete your `welcome-workflow` branch.
19-
1. Wait about 20 seconds for actions to run, then refresh this page (the one you're following instructions from) and an action will automatically close this step and open the next one.
13+
1. Wait about 20 seconds, then refresh this page (the one you're following instructions from). Another workflow will run and will replace this content with instructions for the next step.

.github/steps/5-trigger.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
<!--
2-
<<< Author notes: Step 5 >>>
3-
Start this step by acknowledging the previous step.
4-
Define terms and link to docs.github.com.
5-
-->
6-
71
## Step 5: Trigger the workflow
82

9-
_You've now got a fully functioning workflow! :smile:_
3+
_You've now added a fully functioning workflow to your repository! :smile:_
104

11-
Your new action will run any time a pull request has been opened.
5+
The shell script in the workflow will run whenever a new pull request is opened.
126

13-
**Seeing your _action_ in action**: The status of your action is shown in a pull request before you merge, look for **All checks have passed** when you try out the steps below. You can also view them from the **Actions** tab in your repository. From there, you will see all the actions that have run, and you can click on each action to view details and access log files.
7+
**Seeing your _action_ in action**: The status of each workflow run that's triggered is shown in the pull request before it's merged: look for **All checks have passed** when you try out the steps below. You can also see a list of all the workflows that are running, or have finished running, in the **Actions** tab of your repository. From there, you can click on each workflow run to view more details and access log files.
148

15-
![View an action's log](https://user-images.githubusercontent.com/16547949/62388049-4e64e600-b52a-11e9-8bf5-db0c5452360f.png)
9+
![A screenshot of the Actions tab showing a list of workflow runs.](https://user-images.githubusercontent.com/16547949/62388049-4e64e600-b52a-11e9-8bf5-db0c5452360f.png)
1610

1711
### :keyboard: Activity: Trigger the workflow
1812

1913
1. Make a new branch named `test-workflow`.
20-
1. Commit any change to your branch, such as adding an emoji to your README.md file.
21-
1. Create the pull request on your branch.
22-
1. See your action run on your pull request.
23-
1. Wait about 20 seconds for actions to run, then refresh this page (the one you're following instructions from) and an action will automatically close this step and open the next one.
14+
1. Make a change, such as adding an emoji to your README.md file, and commit the change directly to your new branch.
15+
1. In the **Pull requests** tab, create a pull request that will merge `test-workflow` into `main`.
16+
1. Watch the workflow running in the checks section of the pull request.
17+
1. Notice the comment that the workflow adds to the pull request.
18+
1. Wait about 20 seconds, then refresh this page (the one you're following instructions from). Another workflow will run and will replace this content with instructions for the next step.

.github/steps/X-finish.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
1-
<!--
2-
<<< Author notes: Finish >>>
3-
Review what we learned, ask for feedback, provide next steps.
4-
-->
5-
61
## Finish
72

83
_Congratulations friend, you've completed this course!_
94

10-
<img src=https://octodex.github.com/images/jetpacktocat.png alt=celebrate width=300 align=right>
5+
<img src=https://octodex.github.com/images/jetpacktocat.png alt="Mona the Octocat wearing a jetpack and smiling." width=300 align=right>
116

127
Here's a recap of all the tasks you've accomplished in your repository:
138

149
- You've created your first GitHub Actions workflow file.
1510
- You learned where to make your workflow file.
16-
- You created an event trigger, a job, and steps for your workflow.
11+
- You defined an event trigger, a job, and a step for your workflow.
1712
- You're ready to automate anything you can dream of.
1813

1914
### What's next?
2015

21-
- Learn more about GitHub Actions by reading "[Learn GitHub Actions](https://docs.github.com/actions/learn-github-actions)".
22-
- Use actions created by others in [awesome-actions](https://github.com/sdras/awesome-actions).
23-
- We'd love to hear what you thought of this course [in our discussion board](https://github.com/orgs/skills/discussions/categories/hello-github-actions).
24-
- [Take another GitHub Skills course](https://github.com/skills).
25-
- Learn more about GitHub by reading the "[Get started](https://docs.github.com/get-started)" docs.
26-
- To find projects to contribute to, check out [GitHub Explore](https://github.com/explore).
16+
- Learn more about GitHub Actions by reading "[Learn GitHub Actions](https://docs.github.com/actions/learn-github-actions)"
17+
- Use actions created by others in [awesome-actions](https://github.com/sdras/awesome-actions)
18+
- We'd love to hear what you thought of this course [in our discussion board](https://github.com/orgs/skills/discussions/categories/hello-github-actions)
19+
- [Take another course on GitHub Actions](https://skills.github.com/#automate-workflows-with-github-actions)
20+
- Learn more about GitHub by reading the "[Get started](https://docs.github.com/get-started)" docs
21+
- To find projects to contribute to, check out [GitHub Explore](https://github.com/explore)

README.md

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
11
<header>
22

3-
<!--
4-
<<< Author notes: Course header >>>
5-
Include a 1280x640 image, course title in sentence case, and a concise description in emphasis.
6-
In your repository settings: enable template repository, add your 1280x640 social image, auto delete head branches.
7-
Add your open source license, GitHub uses MIT license.
8-
-->
9-
103
# Hello GitHub Actions
114

12-
_Create a GitHub Action and use it in a workflow._
5+
_Create and run a GitHub Actions workflow._
136

147
</header>
158

16-
<!--
17-
<<< Author notes: Course start >>>
18-
Include start button, a note about Actions minutes,
19-
and tell the learner why they should take the course.
20-
-->
21-
229
## Welcome
2310

2411
Automation is key for streamlining your work processes, and [GitHub Actions](https://docs.github.com/actions) is the best way to supercharge your workflow.
@@ -33,23 +20,12 @@ In this course, you will:
3320

3421
1. Create a workflow
3522
2. Add a job
36-
3. Add actions
23+
3. Add a run step
3724
4. Merge your pull request
38-
5. See the action run
25+
5. See effect of the workflow
3926

4027
### How to start this course
4128

42-
<!-- For start course, run in JavaScript:
43-
'https://github.com/new?' + new URLSearchParams({
44-
template_owner: 'skills',
45-
template_name: 'hello-github-actions',
46-
owner: '@me',
47-
name: 'skills-hello-github-actions',
48-
description: 'My clone repository',
49-
visibility: 'public',
50-
}).toString()
51-
-->
52-
5329
[![start-course](https://user-images.githubusercontent.com/1221423/235727646-4a590299-ffe5-480d-8cd5-8194ea184546.svg)](https://github.com/new?template_owner=skills&template_name=hello-github-actions&owner=%40me&name=skills-hello-github-actions&description=My+clone+repository&visibility=public)
5430

5531
1. Right-click **Start course** and open the link in a new tab.
@@ -61,11 +37,6 @@ In this course, you will:
6137

6238
<footer>
6339

64-
<!--
65-
<<< Author notes: Footer >>>
66-
Add a link to get support, GitHub status page, code of conduct, license link.
67-
-->
68-
6940
---
7041

7142
Get help: [Post in our discussion board](https://github.com/orgs/skills/discussions/categories/hello-github-actions) &bull; [Review the GitHub status page](https://www.githubstatus.com/)

0 commit comments

Comments
 (0)