Update github.ts (#111)
This commit is contained in:
parent
03c4bc34bd
commit
ec9df7c385
1 changed files with 11 additions and 3 deletions
|
@ -141,8 +141,16 @@ export const upload = async (
|
||||||
|
|
||||||
export const release = async (
|
export const release = async (
|
||||||
config: Config,
|
config: Config,
|
||||||
releaser: Releaser
|
releaser: Releaser,
|
||||||
|
maxRetries: number = 3
|
||||||
): Promise<Release> => {
|
): Promise<Release> => {
|
||||||
|
if (maxRetries <= 0) {
|
||||||
|
console.log(
|
||||||
|
`❌ Too many retries. Aborting...`
|
||||||
|
);
|
||||||
|
throw new Error("Too many retries.")
|
||||||
|
}
|
||||||
|
|
||||||
const [owner, repo] = config.github_repository.split("/");
|
const [owner, repo] = config.github_repository.split("/");
|
||||||
const tag =
|
const tag =
|
||||||
config.input_tag_name || config.github_ref.replace("refs/tags/", "");
|
config.input_tag_name || config.github_ref.replace("refs/tags/", "");
|
||||||
|
@ -227,9 +235,9 @@ export const release = async (
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// presume a race with competing metrix runs
|
// presume a race with competing metrix runs
|
||||||
console.log(
|
console.log(
|
||||||
`⚠️ GitHub release failed with status: ${error.status}, retrying...`
|
`⚠️ GitHub release failed with status: ${error.status}, retrying... (${maxRetries - 1} retries remaining)`
|
||||||
);
|
);
|
||||||
return release(config, releaser);
|
return release(config, releaser, maxRetries - 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
|
|
Loading…
Reference in a new issue