From c91ac205a5559702a728ab13e71a7b88d61ff0d2 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 10 Jan 2022 02:14:31 -0800 Subject: [PATCH] tools: use GITHUB_ACTIONS env var in inactivity scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't rewrite the README if we're not running inside a GitHub Action. PR-URL: https://github.com/nodejs/node/pull/41422 Reviewed-By: Anatoli Papirovski Reviewed-By: Michaƫl Zasso --- tools/find-inactive-collaborators.mjs | 9 +++++---- tools/find-inactive-tsc.mjs | 13 +++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tools/find-inactive-collaborators.mjs b/tools/find-inactive-collaborators.mjs index e01b29ac5f9f23..71a00b970a9732 100755 --- a/tools/find-inactive-collaborators.mjs +++ b/tools/find-inactive-collaborators.mjs @@ -189,8 +189,9 @@ const inactive = collaborators.filter((collaborator) => if (inactive.length) { console.log('\nInactive collaborators:\n'); console.log(inactive.map((entry) => `* ${entry.name}`).join('\n')); - console.log('\nGenerating new README.md file...'); - const newReadmeText = await moveCollaboratorToEmeritus(inactive); - fs.writeFileSync(new URL('../README.md', import.meta.url), newReadmeText); - console.log('Updated README.md generated. Please commit these changes.'); + if (process.env.GITHUB_ACTIONS) { + console.log('\nGenerating new README.md file...'); + const newReadmeText = await moveCollaboratorToEmeritus(inactive); + fs.writeFileSync(new URL('../README.md', import.meta.url), newReadmeText); + } } diff --git a/tools/find-inactive-tsc.mjs b/tools/find-inactive-tsc.mjs index 871ca9af1ed9d2..acd2cee45b6fb6 100755 --- a/tools/find-inactive-tsc.mjs +++ b/tools/find-inactive-tsc.mjs @@ -260,10 +260,11 @@ if (inactive.length) { }); console.log(`DETAILS_FOR_COMMIT_BODY=${commitDetails.join(' ')}`); - // Using console.warn() to avoid messing with find-inactive-tsc which consumes - // stdout. - console.warn('Generating new README.md file...'); - const newReadmeText = await moveTscToEmeritus(inactive); - fs.writeFileSync(new URL('../README.md', import.meta.url), newReadmeText); - console.warn('Updated README.md generated. Please commit these changes.'); + if (process.env.GITHUB_ACTIONS) { + // Using console.warn() to avoid messing with find-inactive-tsc which + // consumes stdout. + console.warn('Generating new README.md file...'); + const newReadmeText = await moveTscToEmeritus(inactive); + fs.writeFileSync(new URL('../README.md', import.meta.url), newReadmeText); + } }