in packages/repocop/src/remediation/topics/topic-monitor-production.ts [131:162]
async function applyProductionTopicToOneRepoAndMessageTeams(
fullRepoName: string,
stackName: string,
teamNameSlugs: string[],
octokit: Octokit,
config: Config,
): Promise<void> {
const topic = 'production';
const shortRepoName = removeRepoOwner(fullRepoName);
const { stage } = config;
if (stage === 'PROD') {
await applyTopics(shortRepoName, config.gitHubOrg, octokit, topic);
} else {
console.log(
`Would have applied the ${topic} topic to ${shortRepoName} with stack ${stackName} if stage was PROD.`,
);
}
for (const teamNameSlug of teamNameSlugs) {
const messageText = createMessage(
fullRepoName,
stackName,
teamNameSlug,
MONTHS,
);
console.log('Production topic monitor message text: ');
console.log(messageText);
// have to check the stage again here as we're in the loop
if (stage === 'PROD') {
await notifyOneTeam(fullRepoName, config, teamNameSlug, messageText);
}
}
}