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

Commit f547dbf

Browse files
committed
add output to 10_create-js-files
1 parent 28f4a0a commit f547dbf

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

responses/10_create-js-files.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,17 @@ We will also create a file named `main.js` that resides inside of the `.github/a
5050

5151
That file will look like this:
5252

53-
![screenshot of main.js file](https://i.imgur.com/pTBDECt.png)
53+
![screenshot of main.js file](https://i.imgur.com/oo7WkvE.png)
5454

55-
Like we did in the `joke.js` file, we are first going to bring in our dependencies. Only this time, our dependency isn't something we installed, it's something we wrote! To do that we simply use `require()` to point to the location of the file we wish to bring in.
55+
Like we did in the `joke.js` file, we are first going to bring in our dependencies. Only this time, our dependencies include something we wrote! To do that we simply use `require()` to point to the location of the file we wish to bring in.
56+
57+
We also bring in `@actions/core` so that we can set the output of our Action.
5658

5759
Next we write another **asynchronous JavaScript function** that stores the return value of `getJoke()` in a variable called **joke**.
5860

59-
Then we finish the function with a simple joke logged to the console.
61+
Then we log the joke to the console.
62+
63+
Finally we finish the function with by setting the contents of the joke as the value of the `joke-output` output parameter. We will use this output later in the course.
6064

6165
Don't forget to call the `run()` function.
6266

@@ -91,10 +95,12 @@ Don't forget to call the `run()` function.
9195

9296
```javascript
9397
const getJoke = require("./joke");
98+
const core = require("@actions/core)
9499
95100
async function run() {
96101
const joke = await getJoke();
97102
console.log(joke);
103+
core.setOutput("joke-output", joke)
98104
}
99105
100106
run();

0 commit comments

Comments
 (0)