From 46e2b1818d3f617d76d93a33a6619b19ee289d67 Mon Sep 17 00:00:00 2001 From: Patrick Brosset Date: Fri, 1 Sep 2023 16:28:00 +0200 Subject: [PATCH] Attempt to use the github_token --- scripts/report-references-to-old-versions.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/report-references-to-old-versions.js b/scripts/report-references-to-old-versions.js index dbc700ae8f..cb72ed3605 100644 --- a/scripts/report-references-to-old-versions.js +++ b/scripts/report-references-to-old-versions.js @@ -99,7 +99,7 @@ async function findReferencesToEdgeVersionsOlderThanRelease() { async function createIssue(title, content) { // Create a new issue. - const octokit = github.getOctokit(github.token); + const octokit = github.getOctokit(process.env.GITHUB_TOKEN); const {data: issue} = await octokit.rest.issues.create({ owner: "MicrosoftDocs", @@ -124,6 +124,11 @@ findReferencesToEdgeVersionsOlderThanRelease().then(matches => { console.log('Outdated Edge version references found:'); console.log(report); + if (!process.env.GITHUB_TOKEN) { + console.log('No GITHUB_TOKEN environment variable found, skipping issue creation.'); + return; + } + return createIssue('Outdated Edge version references found', report).then(issue => { console.log(`Created issue ${issue.number} at ${issue.html_url}`); });