Skip to content

Commit 8d79334

Browse files
Update to 3 in STEP and README.md
1 parent c9bc4ce commit 8d79334

File tree

2 files changed

+37
-15
lines changed

2 files changed

+37
-15
lines changed

.github/steps/-step.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2
1+
3

README.md

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,69 @@ _Write your own GitHub JavaScript Action and automate customized tasks unique to
1515
</header>
1616

1717
<!--
18-
<<< Author notes: Step 2 >>>
18+
<<< Author notes: Step 3 >>>
1919
Start this step by acknowledging the previous step.
2020
Define terms and link to docs.github.com.
2121
-->
2222

23-
## Step 2: Configure Your Action
23+
## Step 3: Create the metadata file
2424

25-
_Let's keep going! :bike:_
25+
_Nice work configuring your action :smile:_
2626

27-
### Excellent!
27+
## Action metadata
2828

29-
Now that we have the custom action pre-requisites, let us create **joke-action** action.
29+
Every GitHub Action that we write needs to be accompanied by a metadata file. This file has a few rules to it, as are indicated below:
3030

31-
### :keyboard: Activity 1: Configure Your Action
31+
- Filename **must** be `action.yml`.
32+
- Required for both Docker container and JavaScript actions.
33+
- Written in YAML syntax.
34+
35+
This file defines the following information about your action:
36+
37+
| Parameter | Description | Required |
38+
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | :----------------: |
39+
| Name | The name of your action. Helps visually identify the actions in a job. | :white_check_mark: |
40+
| Description | A summary of what your action does. | :white_check_mark: |
41+
| Inputs | Input parameters allow you to specify data that the action expects to use during runtime. These parameters become environment variables in the runner. | :x: |
42+
| Outputs | Specifies the data that subsequent actions can use later in the workflow after the action that defines these outputs has run. | :x: |
43+
| Runs | The command to run when the action executes. | :white_check_mark: |
44+
| Branding | You can use a color and Feather icon to create a badge to personalize and distinguish your action in GitHub Marketplace. | :x: |
45+
46+
---
47+
48+
Read more about [Action metadata](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions)
49+
50+
### :keyboard: Activity 1: Create the metadata file
3251

3352
All of the following steps take place inside of the `.github/actions/joke-action` directory.
3453

35-
We will start with using the parameters that are **required** and later implement some optional parameters as our action evolves.
54+
Our action does not require much metadata for it to run correctly. We will not be accepting any inputs, we will however be setting a single output this time.
3655

37-
1. Create a new file in: `.github/actions/joke-action/action.yml`
38-
2. Add the following contents to the `.github/actions/joke-action/action.yml` file:
56+
1. Update the action metadata file `.github/actions/joke-action/action.yml` with the following content:
3957

4058
```yaml
4159
name: "my joke action"
4260

4361
description: "use an external API to retrieve and display a joke"
4462

63+
outputs:
64+
joke-output:
65+
description: The resulting joke from the icanhazdadjokes API
66+
4567
runs:
4668
using: "node16"
4769
main: "main.js"
4870
```
4971
50-
3. Save the `action.yml` file
51-
4. Commit the changes and push them to the `main` branch:
72+
2. Save the `action.yml` file
73+
3. Commit the changes and push them to GitHub:
5274
```shell
5375
git add action.yml
54-
git commit -m 'create action.yml'
55-
git pull
76+
git pull
77+
git commit -m 'add metadata for the joke action'
5678
git push
5779
```
58-
5. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.
80+
4. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.
5981

6082
<footer>
6183

0 commit comments

Comments
 (0)