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

Commit 15a105b

Browse files
committed
tidy up minor fixes and introduce final step
1 parent 1e67291 commit 15a105b

9 files changed

+83
-68
lines changed

config.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ steps:
193193
with: 09_new-action.md
194194
issue: Knock Knock...
195195
data:
196+
# The following workflowFile var does not point where it should for some reason
196197
workflowFile: "%payload.repository.html_url%/edit/master/.github/workflows/my-workflow.yml"
197198
actionsUrl: "%payload.repository.html_url%/actions"
198199

@@ -364,7 +365,16 @@ steps:
364365
left: "%payload.pull_request.title%"
365366
operator: ===
366367
right: Use Outputs
368+
- type: removeBranchProtection
367369
- type: respond
368370
with: 15_add-a-label.md
369371
data:
370372
actionsUrl: "%payload.repository.html_url%/actions"
373+
374+
- title: Wrapping things up
375+
description: Final notes before you go
376+
event: pull_request.closed
377+
actions:
378+
- type: createIssue
379+
title: Last minute notes
380+
body: 16_using-ncc.md

responses/07_update-files.md

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,76 +2,80 @@
22

33
### :keyboard: Activity: Add input parameters
44

5-
That was a lot of information that you just learned. @{{user.login}} it is time for you to put it in practice.
5+
That was a lot of information that you just learned. @{{user.login}} it is time for you to put it in practice.
66

77
1. Using your code editor change these files to reflect the code in the examples shown above:
88

9-
<details><summary>main.js</summary>
9+
<details><summary>main.js</summary>
1010

11-
```javascript
12-
const core = require("@actions/core");
11+
```javascript
12+
const core = require("@actions/core");
1313

14-
const firstGreeting = core.getInput("first-greeting");
15-
const secondGreeting = core.getInput("second-greeting");
16-
const thirdGreeting = core.getInput("third-greeting");
14+
const firstGreeting = core.getInput("first-greeting");
15+
const secondGreeting = core.getInput("second-greeting");
16+
const thirdGreeting = core.getInput("third-greeting");
1717

18-
console.log(`Hello ${firstGreeting}`);
19-
console.log(`Hello ${secondGreeting}`);
20-
if (thirdGreeting) {
21-
console.log(`Hello ${thirdGreeting}`);
22-
}
23-
```
24-
</details>
18+
console.log(`Hello ${firstGreeting}`);
19+
console.log(`Hello ${secondGreeting}`);
20+
if (thirdGreeting) {
21+
console.log(`Hello ${thirdGreeting}`);
22+
}
23+
```
2524

26-
<details><summary>Action.yml</summary>
25+
</details>
2726

28-
```yaml
29-
name: "my hello action"
27+
<details><summary>Action.yml</summary>
3028

31-
description: "say hello with Actions"
29+
```yaml
30+
name: "my hello action"
3231

33-
inputs:
34-
first-greeting:
35-
description: who you would like to greet in the console
36-
required: true
37-
default: Hubot
32+
description: "say hello with Actions"
3833

39-
second-greeting:
40-
description: who to greet
41-
required: true
42-
default: Mona the Octocat
34+
inputs:
35+
first-greeting:
36+
description: who you would like to greet in the console
37+
required: true
38+
default: Hubot
4339

44-
third-greeting:
45-
description: another greeting
46-
required: false
40+
second-greeting:
41+
description: who to greet
42+
required: true
43+
default: Mona the Octocat
4744

48-
runs:
49-
using: "node12"
50-
main: "main.js"
51-
```
52-
</details>
45+
third-greeting:
46+
description: another greeting
47+
required: false
5348

54-
<details><summary>my-workflow.yml</summary>
49+
runs:
50+
using: "node12"
51+
main: "main.js"
52+
```
5553
56-
```yaml
57-
name: JS Actions
54+
</details>
5855
59-
on: [push]
56+
<details><summary>my-workflow.yml</summary>
6057
61-
jobs:
62-
action:
58+
```yaml
59+
name: JS Actions
6360

64-
runs-on: ubuntu-latest
61+
on: [push]
6562

66-
steps:
67-
- uses: actions/checkout@v1
63+
jobs:
64+
action:
65+
runs-on: ubuntu-latest
66+
67+
steps:
68+
- uses: actions/checkout@v1
69+
70+
- name: hello-action
71+
uses: ./.github/actions/hello-world
72+
with:
73+
first-greeting: Learning Lab User
74+
75+
```
76+
77+
</details>
6878

69-
- name: hello-action
70-
uses: ./.github/actions/hello-world
71-
with:
72-
first-greeting: Learning Lab User
73-
```
74-
</details>
7579
2. Save the changes to each file
7680
3. Commit the changes to this branch
7781
`git add .`
@@ -82,6 +86,3 @@ That was a lot of information that you just learned. @{{user.login}} it is time
8286
---
8387

8488
I'll respond here when you finish this step.
85-
86-
87-

responses/09_new-action.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22

33
Before we continue we are going to need to do a few things. First and foremost our workflow is currently setup to run each time there is a `push` event to this repository. Let's comment out our current workflow to prevent things from running but preserve the things you've worked on up to this point.
44

5-
You will still see the workflow trying to execute with every push if you look at the [Actions tab]({{actionsUrl}}), however it will seem as though it fails. This is because there is a workflow file in the `.github/workflows` directory. The failure isn't actually a failure either, if you expand it you will see that there is simple no triggers for that given workflow and therefore it doesn't run. I have placed a screenshot below so you can become familiar with what this error looks like without the need to go to your [Actions tab]({{actionsUrl}}).
6-
7-
![No trigger screenshot](https://i.imgur.com/rARtXc1.png)
8-
95
### :keyboard: Activity: Setting up the next Action
106

117
1. [Edit]({{workflowFile}) your workflow file by commenting out every single line.
128
2. Commit the changes to a new branch and name it `action-two`.
139
3. Create a pull request named **External APIs**
1410

11+
You will still see the workflow trying to execute with every push if you look at the [Actions tab]({{actionsUrl}}), however it will seem as though it fails. This is because there is a workflow file in the `.github/workflows` directory. The failure isn't actually a failure either, if you expand it you will see that there is simple no triggers for that given workflow and therefore it doesn't run. I have placed a screenshot below so you can become familiar with what this error looks like without the need to go to your [Actions tab]({{actionsUrl}}).
12+
13+
![No trigger screenshot](https://i.imgur.com/rARtXc1.png)
1514
Like our first Action, I'll respond in the new pull request when I detect it has been opened.
1615

1716
---

responses/10_action-two.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ Now that you have all the necessary tools installed locally, follow these steps
1414
4. Checkout the `action-two` branch you created for this pull request.
1515
`git checkout action-two`
1616
5. Create a new folder for our Actions files:
17-
`mkdir -p .github/actions/joke-action`
17+
`mkdir joke-action`
18+
**The full path should be `.github/actions/joke-action`**
1819
6. Navigate to the `joke-action` folder you just created:
19-
`cd .github/actions/joke-action`
20+
`cd joke-action`
21+
**This may be different depending on your current directory**
2022
7. Initialize a new project:
2123
`npm init -y`
2224
8. Install the **request** and **request-promise** dependencies using `npm`:

responses/10_create-js-files.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Don't forget to call the `run()` function.
6666

6767
### :keyboard: Creating the javascript files for your new Action.
6868

69-
1. Add the following contents to the `.github/actions/joke-action/joke.js` file:
69+
1. Create and add the following contents to the `.github/actions/joke-action/joke.js` file:
7070

7171
```javascript
7272
const request = require("request-promise");
@@ -91,7 +91,7 @@ Don't forget to call the `run()` function.
9191
```
9292

9393
2. Save the `joke.js` file.
94-
3. Add the following contents to the `.github/actions/joke-action/main.js` file:
94+
3. Create and add the following contents to the `.github/actions/joke-action/main.js` file:
9595

9696
```javascript
9797
const getJoke = require("./joke");

responses/12_trigger-workflow.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Great job! Everything is all set up and now we are ready to start laughing 🤣.
44

55
### :keyboard: Trigger a joke
66

7-
1. Apply the `first joke` label to this pull request
8-
2. Wait a few seconds and then apply the `second joke` label to this pull request
7+
1. Apply a label to this pull request
8+
2. Wait a few seconds and then apply another label to this pull request
99
3. Check the workflow results on the [Actions tab]({{actionsUrl}})
1010

1111
---

responses/13_action-three-workflow.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ We need to make some edits to the `my-workflow.yml` file to get it configured to
2525

2626
### :keyboard: Activity: Final workflow edit
2727

28-
1. [Edit]({{workflowFile}) your `my-workflow.yml` file.
28+
1. [Edit]({{workflowFile}}) your `my-workflow.yml` file.
2929
2. Assign the `ha-ha` step an `id:` of **jokes**
3030
3. Add a new step named `create-issue`.
3131
4. The new step should have its `uses:` property point to `./.github/actions/issue-maker`
32-
5. The `issue-maker` Action should consume the output of the `joke-action`. Add a `with:` property that takes a parameter of `joke:` with a value of `${{steps.jokes.outputs.joke-output}}`
32+
5. The `issue-maker` Action should consume the output of the `joke-action`. Add a `with:` property that takes a parameter of `joke:` with a value of `{% raw %}${{steps.jokes.outputs.joke-output}}{% endraw %}`
3333
6. The `issue-maker` Action should have a property of `repo-token:` which has `${{secrets.GITHUB_TOKEN}}` as the value (I'll explain this in a later step, for now it's a secret 🤣🤷‍♂)
3434
7. Commit the changes to a new branch and name it `action-three`.
3535
8. Create a pull request named **Use Outputs**
@@ -64,8 +64,8 @@ jobs:
6464
- name: create-issue
6565
uses: ./.github/actions/issue-maker
6666
with:
67-
repo-token: ${{secrets.GITHUB_TOKEN}}
68-
joke: ${{steps.jokes.outputs.joke-output}}
67+
repo-token: {% raw %}${{secrets.GITHUB_TOKEN}}{% endraw %}
68+
joke: {% raw %}${{steps.jokes.outputs.joke-output}}{% endraw %}
6969
```
7070
7171
</details>

responses/14_action-three.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Let's create our final project directory and install all the necessary dependenc
2525
`git add .`
2626
`git commit -m 'initial issue maker action'`
2727
10. Push you changes to your repository:
28-
`git push
28+
`git push`
2929

3030
---
3131

responses/14_js-files-activity.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ I'm counting on you this time! In the previous steps I have guided you heavily o
1111
7. Use the `setFailed()` method from the `@actions/core` package to stop your Action and log and error if something goes wrong
1212
8. Save the file
1313
9. Commit and push the changes to this branch
14+
`git add .`
15+
`git commit -m 'adding js files'`
16+
`git push`
1417

1518
I'll respond once you complete these steps, good luck 👍
1619

0 commit comments

Comments
 (0)