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

Commit f908d67

Browse files
committed
create 13_action-three and edit config file
1 parent e0e4970 commit f908d67

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ steps:
295295
action_id: outputIssue
296296
data:
297297
actionsUrl: "%payload.repository.html_url%/actions"
298+
workflowFile: "%payload.repository.html_url%/edit/master/.github/workflows/my-workflow.yml"
298299
- type: respond
299300
with: 12_next-steps.md
300301
issue: External APIs

responses/13_action-three.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
## Action three
2+
3+
Two Actions down, one more to go! Before we move on with building our final Action let's take a second to do a quick recap since this lesson has thrown a lot of information at you.
4+
5+
**The Workflow**
6+
We started out by explaining what a workflow is and how it pertains to the GitHub Actions platform. You learned about how a defined event sets your workflow orchestra in motion.
7+
8+
You learned about runners, jobs, steps and have dabbled in the syntax of a workflow file at every step in this course. I don't want to spoil too much here, but you'll be doing it again in this one as well 😉.
9+
10+
**Action Metadata**
11+
You learned that every Action is accompanied by an `action.yml` file which contains a series of metadata for how the Action behaves. This file defines all of an Actions inputs, outputs, runtime environment, name, description and even branding.
12+
13+
**Hello Action**
14+
Your first JavaScript Action took the traditional path of a "Hello World" introduction. You ended up expanding that Action to accept `inputs` to help make it a little more dynamic. Ultimately, the key takeaway was to understand that you can pass input that is defined in the workflow to an Action as long as the Action's metadata supports it.
15+
16+
When consuming or creating Actions it is incredibly helpful to take care to understand that Actions metadata file.
17+
18+
**Joke Action**
19+
You second JavaScript Action demonstrated that your workflow environment is capable of communicating outside of it's own network. We reached out to an external API and used that information to set `outputs` for another Action to consume. As with `inputs` your Actions metadata must support the ability to set `outputs` if you want to use this option.
20+
21+
**What Next?**
22+
Your third, and final, JavaScript Action of this course is going to use yet another library from the [Actions ToolKit](https://github.com/actions/toolkit). It is also going to consume the `outputs` of your joke Action and use them to help create issues in your repository.
23+
24+
We need to make some edits to the `my-workflow.yml` file to get it configured to use this final Action.
25+
26+
### :keyboard: Activity: Final workflow edit
27+
28+
1. [Edit]({{workflowFile}) your `my-workflow.yml` file.
29+
2. Assign the `ha-ha` step an `id:` of **jokes**
30+
3. Add a new step named `create-issue`.
31+
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}}`
33+
6. Commit the changes to a new branch and name it `action-three`.
34+
7. Create a pull request named **Use Outputs**
35+
36+
Like our other Actions, I'll respond in the new pull request when I detect it has been opened.
37+
38+
---
39+
40+
<details><summary>The complete workflow can be viewed by clicking here</summary>
41+
42+
```yaml
43+
name: JS Actions
44+
45+
on:
46+
pull_request:
47+
types: [labeled]
48+
49+
jobs:
50+
action:
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- uses: actions/checkout@v1
55+
56+
- name: hello-action
57+
uses: ./.github/actions/hello-world
58+
59+
- name: ha-ha
60+
uses: ./.github/actions/joke-action
61+
id: jokes
62+
63+
- name: create-issue
64+
uses: ./.github/actions/issue-maker
65+
with:
66+
joke: ${{steps.jokes.outputs.joke-output}}
67+
```
68+
69+
</details>

0 commit comments

Comments
 (0)