This commit is contained in:
Samuel Attard 2023-11-08 12:25:21 -08:00 коммит произвёл GitHub
Родитель d25cb55753
Коммит 68ea136789
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 31 добавлений и 16 удалений

Просмотреть файл

@ -973,22 +973,37 @@ async function checkRepository(
if (repoVisibility !== 'current') { if (repoVisibility !== 'current') {
const shouldBePrivate = repoVisibility === 'private'; const shouldBePrivate = repoVisibility === 'private';
if (octoRepo.private !== shouldBePrivate) { if (octoRepo.private !== shouldBePrivate) {
builder.addContext( if (octoRepo.stargazers_count === undefined || octoRepo.stargazers_count >= 100) {
`:ninja: Updating repository visibility for \`${octoRepo.name}\` to \`${repoVisibility}\``, builder.addCritical(
); `:octagonal_sign: Aborting repository visibility update for \`${octoRepo.name}\` to \`${repoVisibility}\` as repo has \`${octoRepo.stargazers_count}\` stargazers`,
console.info( );
chalk.yellow('Updating repository visibility for'), console.error(
chalk.cyan(octoRepo.name), chalk.red('Aborting repository visibility update for'),
'to', chalk.cyan(octoRepo.name),
chalk.magenta(repoVisibility), 'to',
); chalk.magenta(repoVisibility),
if (!IS_DRY_RUN) { 'as repo has',
const octokit = await getOctokit(config.organization); chalk.yellow(`${octoRepo.stargazers_count}`),
await octokit.repos.update({ 'stargazers',
owner: config.organization, );
repo: octoRepo.name, } else {
private: shouldBePrivate, builder.addContext(
}); `:ninja: Updating repository visibility for \`${octoRepo.name}\` to \`${repoVisibility}\``,
);
console.info(
chalk.yellow('Updating repository visibility for'),
chalk.cyan(octoRepo.name),
'to',
chalk.magenta(repoVisibility),
);
if (!IS_DRY_RUN) {
const octokit = await getOctokit(config.organization);
await octokit.repos.update({
owner: config.organization,
repo: octoRepo.name,
private: shouldBePrivate,
});
}
} }
} }
} }