build: fix release CI jobs start script (#30521)

This broke in #30492, we weren't handled 20X status codes and weren't authing to appveyor correctly.
This commit is contained in:
Samuel Attard 2021-08-13 10:25:17 -07:00 committed by GitHub
parent 17615654e8
commit 93b1d2d932
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,12 +37,15 @@ let jobRequestedCount = 0;
async function makeRequest ({ auth, url, headers, body, method }) {
const response = await got(url, {
headers,
headers: {
Authorization: auth && auth.bearer ? `Bearer ${auth.bearer}` : undefined,
...(headers || {})
},
body,
method,
auth: auth ? `${auth.username}:${auth.password}` : undefined
auth: auth && auth.password ? `${auth.username}:${auth.password}` : undefined
});
if (response.statusCode !== 200) {
if (response.statusCode < 200 || response.statusCode >= 300) {
console.error('Error: ', `(status ${response.statusCode})`, response.body);
throw new Error(`Unexpected status code ${response.statusCode} from ${url}`);
}