More testing

This commit is contained in:
Janos 2021-07-28 08:56:07 +02:00
parent 3bdea83a5f
commit cd87a7e4b4
No known key found for this signature in database
GPG key ID: 465EF45E51CBA2BA

View file

@ -46,30 +46,13 @@ async function downloadGofmt(octokit, version, versionPrefix, org, repo) {
// No pagination added, we are optimistic that there is a stable release within the first 100 // No pagination added, we are optimistic that there is a stable release within the first 100
// releases. // releases.
}) })
let done = false
let tries = 0 let tries = 0
for (let release of releases.data) { for (let release of releases.data) {
if (version !== "" && release.name === version) { if ((version !== "" && release.name === version) || (!release.prerelease && release.name.startsWith(versionPrefix))) {
console.log("Found release " + release.name + " matching criteria, attempting to download binary...") console.log("Found release " + release.name + " matching criteria, attempting to download binary...")
try { try {
await downloadRelease(octokit, org, repo, release) await downloadRelease(octokit, org, repo, release)
done = true return
break
} catch (e) {
tries++
if (tries > 3) {
console.log("Binary download failed, tried " + tries + " times, giving up. (" + e + ")")
throw e
}
console.log("Binary download failed, trying next release. (" + e + ")")
}
}
if (!release.prerelease && release.name.startsWith(versionPrefix)) {
console.log("Found release " + release.name + " matching criteria, attempting to download binary...")
try {
await downloadRelease(octokit, org, repo, release)
done = true
break
} catch (e) { } catch (e) {
tries++ tries++
if (tries > 3) { if (tries > 3) {
@ -80,9 +63,7 @@ async function downloadGofmt(octokit, version, versionPrefix, org, repo) {
} }
} }
} }
if (!done) { throw "Failed to find a release matching the criteria."
throw "Failed to find a release matching the criteria."
}
} }
try { try {