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}`); });