зеркало из https://github.com/electron/sheriff.git
feat: add stargazer failsafe (#54)
This commit is contained in:
Родитель
d25cb55753
Коммит
68ea136789
|
@ -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,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче