tools: use GITHUB_ACTIONS env var in inactivity scripts

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 <apapirovski@mac.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
Rich Trott 2022-01-10 02:14:31 -08:00 committed by GitHub
parent f65bbce90b
commit c8d38e4933
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View File

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

View File

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