Skip to content

Commit

Permalink
tools: use GITHUB_ACTIONS env var in inactivity scripts
Browse files Browse the repository at this point in the history
Don't rewrite the README if we're not running inside a GitHub Action.

PR-URL: #41422
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
  • Loading branch information
Trott authored and targos committed Jan 14, 2022
1 parent 60025bd commit c91ac20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
9 changes: 5 additions & 4 deletions tools/find-inactive-collaborators.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
13 changes: 7 additions & 6 deletions tools/find-inactive-tsc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit c91ac20

Please sign in to comment.