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

Commit 4079446

Browse files
committed
removing redundancy in responses
1 parent f68dc10 commit 4079446

7 files changed

Lines changed: 36 additions & 14 deletions

File tree

04_hello-result.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ steps:
122122
body: 04_explain-metadata.md
123123
head: hello-world
124124
action_id: helloPr
125+
data:
126+
actionsUrl: "%payload.repository.html_url%/actions"
125127
- type: respond
126128
with: 04_hello-pr.md
127129
issue: Setting up your development environment
@@ -139,19 +141,17 @@ steps:
139141
actions:
140142
- type: respond
141143
with: 04_explain-runs.md
144+
data:
145+
actionsUrl: "%payload.repository.html_url%/actions"
142146
- type: respond
143147
with: 04_main-js.md
144148
data:
145149
actionsUrl: "%payload.repository.html_url%/actions"
146150

147151
- title: Adding input parameters
148152
description: extend your action to accept input parameters
149-
event: check_suite.completed
153+
event: pull_request.synchronize
150154
actions:
151-
- type: gate
152-
left: "%payload.check_suite.app.name%"
153-
operator: ===
154-
right: "GitHub Actions"
155155
- type: respond
156156
with: 04_hello-result.md
157157
- type: respond

responses/04_create-metadata.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ We will start with using the parameters that are **required** and later implemen
1515
3. Next, add a `description` parameter and give it a value of `"say hello with Actions"`
1616
4. Lastly, define the `run` parameter to use `"node12"` to execute the `"main.js"`
1717

18-
<details><summary>View the complete file</summary><img src="https://i.imgur.com/xCuBdI4.png" alt="screenshot of action.yml file" />
19-
20-
<details><summary>Raw code to copy</summary>
18+
<details><summary>View the complete file</summary>
2119

2220
```yaml
2321
name: "my hello action"
@@ -30,7 +28,7 @@ We will start with using the parameters that are **required** and later implemen
3028
```
3129
</details>
3230
33-
</details>
31+
3432
3533
5. Save the `action.yml` file
3634
6. commit the changes:

responses/04_explain-metadata.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
## Action metadata
22

3+
#### The failing workflow
4+
Before we jump into the details of Action metadata, it might be helpful to examine our workflow to understand the order that things happen. I have attached a screenshot below of the most recent workflow run, you can also follow along by clicking on the [Actions tab]({{actionsUrl}}) for your repository.
5+
6+
![](https://i.imgur.com/FPOjK3R.png)
7+
8+
Notice that our third workflow step, the one that is looking for our Action is failing. We expect this, but the magic ✨is in the error message!
9+
10+
That step is looking for a specific file, and in our case it's looking for the `action.yml` file. It's not looking for a JavaScript file or a `config.yml` file.
11+
12+
Because that file is non-existent in the `hello-world` directory we see this error. So let's start by talking about, and creating, that `action.yml` file.
13+
14+
#### The need to know of Action metadata
15+
16+
317
Every GitHub Action that we write needs to be accompanied by a metadata file. This file has a few rules to it, lets outline those now:
418

519
- Filename **must** be `action.yml`

responses/04_explain-runs.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ runs:
2121
main: 'bread.js'
2222
```
2323
24+
#### From our workflows perspective
25+
26+
This execution is visible from within your workflow. To save time I have included a screenshot of what your workflow currently looks like. As always, you can follow along in the [Actions tab]({{actionUrl}}).
27+
28+
![A look into the failed run](https://i.imgur.com/nJtqEct.png)
29+
30+
Look 👀, now we have a new error! We are totally making progress here! What we can reason from this output is that our `action.yml` file was found and read. Since we defined the `main:` parameter to point to a file named `main.js` the workflow looked for that file in the root of the `hello-world` directory, but since it couldn't find it the workflow fails.
31+
32+
Let's fix this next!
33+
2434
---
2535

2636
Keep this in mind because later we will be referencing a file that is not in the same directory of the `action.yml`

responses/04_hello-result.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
result of workflow run
2+
3+
![](https://i.imgur.com/NDQjAx6.png)

responses/04_main-js.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,14 @@ The first iteration of our Action will follow the traditional path of logging "H
1616

1717
1. Create a file named `main.js`
1818
2. Log "Hello World" to the console
19-
<details><summary>View the complete file</summary><img src="https://i.imgur.com/ABXoNtE.png" alt="screenshot of main.js file" />
20-
21-
<details><summary>Raw code to copy</summary>
19+
<details><summary>View the complete file</summary>
2220

2321
```javascript
2422
console.log("Hello World")
2523
```
2624
</details>
2725

28-
</details>
26+
2927
3. Save the `main.js` file
3028
4. commit the changes:
3129
`git add .`

0 commit comments

Comments
 (0)