Skip to content

Commit c91ac20

Browse files
Trotttargos
authored andcommitted
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: #41422 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 60025bd commit c91ac20

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

tools/find-inactive-collaborators.mjs

+5-4
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ const inactive = collaborators.filter((collaborator) =>
189189
if (inactive.length) {
190190
console.log('\nInactive collaborators:\n');
191191
console.log(inactive.map((entry) => `* ${entry.name}`).join('\n'));
192-
console.log('\nGenerating new README.md file...');
193-
const newReadmeText = await moveCollaboratorToEmeritus(inactive);
194-
fs.writeFileSync(new URL('../README.md', import.meta.url), newReadmeText);
195-
console.log('Updated README.md generated. Please commit these changes.');
192+
if (process.env.GITHUB_ACTIONS) {
193+
console.log('\nGenerating new README.md file...');
194+
const newReadmeText = await moveCollaboratorToEmeritus(inactive);
195+
fs.writeFileSync(new URL('../README.md', import.meta.url), newReadmeText);
196+
}
196197
}

tools/find-inactive-tsc.mjs

+7-6
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,11 @@ if (inactive.length) {
260260
});
261261
console.log(`DETAILS_FOR_COMMIT_BODY=${commitDetails.join(' ')}`);
262262

263-
// Using console.warn() to avoid messing with find-inactive-tsc which consumes
264-
// stdout.
265-
console.warn('Generating new README.md file...');
266-
const newReadmeText = await moveTscToEmeritus(inactive);
267-
fs.writeFileSync(new URL('../README.md', import.meta.url), newReadmeText);
268-
console.warn('Updated README.md generated. Please commit these changes.');
263+
if (process.env.GITHUB_ACTIONS) {
264+
// Using console.warn() to avoid messing with find-inactive-tsc which
265+
// consumes stdout.
266+
console.warn('Generating new README.md file...');
267+
const newReadmeText = await moveTscToEmeritus(inactive);
268+
fs.writeFileSync(new URL('../README.md', import.meta.url), newReadmeText);
269+
}
269270
}

0 commit comments

Comments
 (0)