|
| 1 | +## Create and edit the third Actions action.yml file |
| 2 | + |
| 3 | +Like our "hello world" Action, this Action will require at least one `input:` parameter. We need this parameter so that our JavaScript for this Action has access to the `output:` from the joke Action. |
| 4 | + |
| 5 | +If you recall, in the `my-workflow.yml` file, we stated this Action would take a specific input named `joke:` and we set it's value to the output of the previous Action. |
| 6 | + |
| 7 | +```yaml |
| 8 | +- name: create-issue |
| 9 | + uses: ./.github/actions/issue-maker |
| 10 | + with: |
| 11 | + joke: ${{steps.jokes.outputs.joke-output}} |
| 12 | +``` |
| 13 | +
|
| 14 | +Because of this, we need to define `joke:` as one of our `inputs:` for this action. Remember when we did this with the first Action? It looked a little like this: |
| 15 | + |
| 16 | +```yaml |
| 17 | +inputs: |
| 18 | + first-greeting: |
| 19 | + description: who you would like to greet in the console |
| 20 | + required: true |
| 21 | + default: Hubot |
| 22 | +``` |
| 23 | + |
| 24 | +Now, we will do something similar so that our Action matches what our workflow expects. |
| 25 | + |
| 26 | +### :keyboard: Activity: Create the final metadata file |
| 27 | + |
| 28 | +💡All of the following steps take place inside of the `.github/actions/issue-maker` directory. |
| 29 | + |
| 30 | +We will use the `joke-output`, as well as an issue title, in in this portion of the course so we need to accept `inputs:` for our Action. |
| 31 | + |
| 32 | +1. Create a file named `action.yml` |
| 33 | +2. Use the `name` parameter to name your Action `"issue maker"` |
| 34 | +3. Next, add a `description` parameter and give it a value of `"consume the output of the previous Action and create a new issue in the repository"` |
| 35 | +4. Create an `inputs:` with an id of `joke:` and add a `description:` of `"This will become the body of the created issue"` |
| 36 | +5. Create another `inputs:` with an id of `issue-title:` and a `description:` of `"Every issue needs a title, it's nice to supply one, even though you could do this dynamically within your code"` |
| 37 | +6. Lastly, define the `run` parameter to use `"node12"` to execute the `"main.js"` |
| 38 | +7. Save the `action.yml` file |
| 39 | +8. commit the changes: |
| 40 | + `git add .` |
| 41 | + `git commit -m 'update action.yml'` |
| 42 | +9. push the changes to the `action-three` branch: |
| 43 | + `git push` |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +<details><summary>View the complete file</summary> |
| 48 | + |
| 49 | +```yaml |
| 50 | +name: "I have issues" |
| 51 | +
|
| 52 | +description: "consume the output of the previous Action and create a new issue in the repository" |
| 53 | +
|
| 54 | +inputs: |
| 55 | + joke: |
| 56 | + description: "This will become the body of the created issue" |
| 57 | + issue-title: |
| 58 | + description: "Every issue needs a title, it's nice to supply one, even though you could do this dynamically within your code" |
| 59 | +
|
| 60 | +runs: |
| 61 | + using: "node12" |
| 62 | + main: "main.js" |
| 63 | +``` |
| 64 | + |
| 65 | +</details> |
0 commit comments