include status code is error message

This commit is contained in:
Robert Brignull
2020-05-01 11:45:00 +01:00
parent 0c4fc16b49
commit a23cb1d61a
2 changed files with 8 additions and 8 deletions

8
lib/upload-lib.js generated
View File

@@ -78,15 +78,15 @@ async function uploadPayload(payload) {
const requestID = res.message.headers["x-github-request-id"];
// On any other status code that's not 5xx mark the upload as failed
if (!statusCode || statusCode < 500 || statusCode >= 600) {
core.setFailed('Upload failed (' + requestID + '): ' + await res.readBody());
core.setFailed('Upload failed (' + requestID + '): (' + statusCode + ') ' + await res.readBody());
return;
}
// On a 5xx status code we may retry the request
if (attempt < backoffPeriods.length) {
// Log the failure as a warning but don't mark the action as failed yet
core.warning('Upload attempt (' + (attempt + 1) + ' of ' + (backoffPeriods.length + 1) +
') failed (' + requestID + '). Retrying in ' + backoffPeriods[attempt] + ' seconds: ' +
await res.readBody());
') failed (' + requestID + '). Retrying in ' + backoffPeriods[attempt] +
' seconds: (' + statusCode + ') ' + await res.readBody());
// Sleep for the backoff period
await new Promise(r => setTimeout(r, backoffPeriods[attempt] * 1000));
continue;
@@ -95,7 +95,7 @@ async function uploadPayload(payload) {
// If the upload fails with 5xx then we assume it is a temporary problem
// with turbo-scan and not an error that the user has caused or can fix.
// We avoid marking the job as failed to avoid breaking CI workflows.
core.error('Upload failed (' + requestID + '): ' + await res.readBody());
core.error('Upload failed (' + requestID + '): (' + statusCode + ') ' + await res.readBody());
return;
}
}