Skip to content

Commit 6a880e1

Browse files
authored
creating joke.js and main.js
1 parent 25e2874 commit 6a880e1

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const request = require("request-promise");
2+
3+
const options = {
4+
method: "GET",
5+
uri: "https://icanhazdadjoke.com/",
6+
headers: {
7+
Accept: "application/json",
8+
"User-Agent": "Writing JavaScript action GitHub Skills course.",
9+
},
10+
json: true,
11+
};
12+
13+
async function getJoke() {
14+
const res = await request(options);
15+
return res.joke;
16+
}
17+
18+
module.exports = getJoke;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const getJoke = require("./joke");
2+
const core = require("@actions/core");
3+
4+
async function run() {
5+
const joke = await getJoke();
6+
console.log(joke);
7+
core.setOutput("joke-output", joke);
8+
}
9+
10+
run();

0 commit comments

Comments
 (0)