Merge pull request #9353 from Kilo-Org/fix/ovsx-publish-retry

fix(vscode): retry Open VSX publish on transient failures
This commit is contained in:
Mark IJbema
2026-04-22 14:41:49 +02:00
committed by GitHub
+18 -1
View File
@@ -47,7 +47,11 @@ for (const target of targets) {
console.log(` ✅ Published ${target} to VS Code Marketplace`)
console.log(`\n📤 Publishing ${target} to Open VSX${prerelease ? " (pre-release)" : ""}...`)
await $`npx ovsx publish ${flag} --pat ${process.env.OPENVSX_TOKEN} --packagePath ${vsixPath}`
await retry(() => $`npx ovsx publish ${flag} --pat ${process.env.OPENVSX_TOKEN} --packagePath ${vsixPath}`, {
attempts: 3,
delay: 10_000,
label: `ovsx publish ${target}`,
})
console.log(` ✅ Published ${target} to Open VSX`)
}
@@ -58,3 +62,16 @@ if (Script.release) {
}
console.log("\n✨ All targets published successfully!")
async function retry<T>(fn: () => Promise<T>, opts: { attempts: number; delay: number; label: string }): Promise<T> {
for (let i = 1; i <= opts.attempts; i++) {
try {
return await fn()
} catch (err) {
if (i === opts.attempts) throw err
console.warn(` ⚠️ ${opts.label} failed (attempt ${i}/${opts.attempts}), retrying in ${opts.delay / 1000}s...`)
await new Promise((r) => setTimeout(r, opts.delay))
}
}
throw new Error("unreachable")
}