fix: cover release fetching/creation with retryAttempts (#1342)
real world tests / v2 (--verbose --debug, windows-latest) (push) Waiting to run
real world tests / v2 (--verbose --target universal-apple-darwin --debug, macos-latest) (push) Waiting to run
real world tests / v2 (--verbose --target x86_64-apple-darwin --debug, macos-latest) (push) Waiting to run
CI / CI (push) Waiting to run
covector version or publish / covector (push) Waiting to run
real world tests / v2 (--verbose --debug, android, ubuntu-latest) (push) Waiting to run
real world tests / v2 (--verbose --debug, ubuntu-22.04) (push) Waiting to run
real world tests / v2 (--verbose --debug, ubuntu-24.04-arm) (push) Waiting to run
real world tests / v2 (--verbose --debug, windows-11-arm) (push) Waiting to run
real world tests / v2 (--verbose --target aarch64-apple-darwin --debug, macos-latest) (push) Waiting to run
real world tests / v2 (--verbose --debug, windows-latest) (push) Waiting to run
real world tests / v2 (--verbose --target universal-apple-darwin --debug, macos-latest) (push) Waiting to run
real world tests / v2 (--verbose --target x86_64-apple-darwin --debug, macos-latest) (push) Waiting to run
CI / CI (push) Waiting to run
covector version or publish / covector (push) Waiting to run
real world tests / v2 (--verbose --debug, android, ubuntu-latest) (push) Waiting to run
real world tests / v2 (--verbose --debug, ubuntu-22.04) (push) Waiting to run
real world tests / v2 (--verbose --debug, ubuntu-24.04-arm) (push) Waiting to run
real world tests / v2 (--verbose --debug, windows-11-arm) (push) Waiting to run
real world tests / v2 (--verbose --target aarch64-apple-darwin --debug, macos-latest) (push) Waiting to run
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
action: patch
|
||||
---
|
||||
|
||||
`retryAttempts` now also covers fetching/creating the GitHub release. Previously this was the only GitHub API call that was never retried, so a single transient network failure (e.g. a connect timeout) could fail the job after a successful build.
|
||||
@@ -157,7 +157,7 @@ jobs:
|
||||
# default: ./
|
||||
projectPath: ''
|
||||
|
||||
# The number of times to re-try building the app if the initial build fails or uploading assets if the upload fails.
|
||||
# The number of times to re-try building the app if the initial build fails, or fetching/creating the release and uploading assets if they fail.
|
||||
# Some small internal steps may be re-tried regardless of this config.
|
||||
#
|
||||
# default: 0
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ inputs:
|
||||
args:
|
||||
description: 'Arguments for the `tauri build` command'
|
||||
retryAttempts:
|
||||
description: 'The number of times to re-try building the app if the initial build fails or uploading assets if the upload fails.'
|
||||
description: 'The number of times to re-try building the app if the initial build fails, or fetching/creating the release and uploading assets if they fail.'
|
||||
owner:
|
||||
description: 'The account owner of the repository'
|
||||
repo:
|
||||
|
||||
Vendored
+25
-25
File diff suppressed because one or more lines are too long
+3
-4
@@ -114,10 +114,9 @@ async function run(): Promise<void> {
|
||||
body = body.replace(regex, template.value);
|
||||
});
|
||||
|
||||
const releaseData = await getOrCreateRelease(
|
||||
tagName,
|
||||
releaseName || undefined,
|
||||
body,
|
||||
const releaseData = await retry(
|
||||
() => getOrCreateRelease(tagName, releaseName || undefined, body),
|
||||
retryAttempts,
|
||||
);
|
||||
releaseId = releaseData.id;
|
||||
core.setOutput('releaseUploadUrl', releaseData.uploadUrl);
|
||||
|
||||
+6
-3
@@ -621,10 +621,10 @@ export function getTargetInfo(targetPath?: string): TargetInfo {
|
||||
/// Examples
|
||||
/// - retry(fn, 0) = run fn once then return no matter the success status
|
||||
/// - retry(fn, 3) = if all tries fail, fn will be executed 4 times
|
||||
export async function retry(
|
||||
fn: () => Promise<unknown>,
|
||||
export async function retry<T>(
|
||||
fn: () => Promise<T>,
|
||||
additionalAttempts: number,
|
||||
): Promise<unknown> {
|
||||
): Promise<T> {
|
||||
const attempts = additionalAttempts + 1;
|
||||
for (let attempt = 1; attempt <= attempts; attempt++) {
|
||||
try {
|
||||
@@ -640,6 +640,9 @@ export async function retry(
|
||||
await sleep(Math.floor(Math.random() * 10) + 1);
|
||||
}
|
||||
}
|
||||
// Unreachable (the loop always returns or throws since attempts is at least
|
||||
// 1); satisfies the declared return type.
|
||||
return fn();
|
||||
}
|
||||
|
||||
async function sleep(seconds: number) {
|
||||
|
||||
Reference in New Issue
Block a user