From ec3cf18ccf479ce19d8f2ec0e6e46697e8411086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Aur=C3=A8le=20Martin?= Date: Wed, 7 Oct 2020 19:50:25 +0200 Subject: [PATCH] Update 14_create-js-files.md Hi, Completing this course, I've found that the previous code was not working as it was deprecated (from what I came to understand) and you now need to require Octokit from it's own package. --- responses/14_create-js-files.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/responses/14_create-js-files.md b/responses/14_create-js-files.md index c5076bc..5bd84d2 100644 --- a/responses/14_create-js-files.md +++ b/responses/14_create-js-files.md @@ -26,6 +26,7 @@ The first two lines will import packages from the [Actions ToolKit](https://gith ```javascript const core = require("@actions/core"); const github = require("@actions/github"); +const { Octokit} = require('@octokit/rest') ``` **Creating the main function** @@ -89,7 +90,10 @@ async function run() { const jokeBody = core.getInput("joke"); const token = core.getInput("repo-token"); - const octokit = github.getOctokit(token); + const octokit = new Octokit({ + auth: token, + userAgent: 'action-three', + }); } catch (err) {} } @@ -106,7 +110,10 @@ async function run() { const jokeBody = core.getInput("joke"); const token = core.getInput("repo-token"); - const octokit = github.getOctokit(token); + const octokit = new Octokit({ + auth: token, + userAgent: 'action-three', + }); const newIssue = await octokit.issues.create({ repo: github.context.repo.repo, @@ -132,7 +139,10 @@ async function run() { const jokeBody = core.getInput("joke"); const token = core.getInput("repo-token"); - const octokit = github.getOctokit(token); + const octokit = new Octokit({ + auth: token, + userAgent: 'action-three', + }); const newIssue = await octokit.issues.create({ repo: github.context.repo.repo,