Skip to content

Commit

Permalink
Update github.ts (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhalaly authored and softprops committed Jul 25, 2021
1 parent 2934fce commit 04c14f5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/github.ts
Expand Up @@ -141,8 +141,16 @@ export const upload = async (

export const release = async (
config: Config,
releaser: Releaser
releaser: Releaser,
maxRetries: number = 3
): 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 tag =
config.input_tag_name || config.github_ref.replace("refs/tags/", "");
Expand Down Expand Up @@ -227,9 +235,9 @@ export const release = async (
} catch (error) {
// presume a race with competing metrix runs
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 {
console.log(
Expand Down

0 comments on commit 04c14f5

Please sign in to comment.