Manually convert response.data to a JSON string.

This commit is contained in:
Chris Gavin 2020-06-24 13:50:52 +01:00
parent 74c48f71fa
commit 464ce1b43a
No known key found for this signature in database
GPG key ID: 07F950B80C27E4DA
3 changed files with 7 additions and 7 deletions

6
lib/upload-lib.js generated
View file

@ -71,7 +71,7 @@ async function uploadPayload(payload) {
const requestID = response.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 + '): (' + statusCode + ') ' + response.data);
core.setFailed('Upload failed (' + requestID + '): (' + statusCode + ') ' + JSON.stringify(response.data));
return false;
}
// On a 5xx status code we may retry the request
@ -79,7 +79,7 @@ async function uploadPayload(payload) {
// 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: (' + statusCode + ') ' + response.data);
' seconds: (' + statusCode + ') ' + JSON.stringify(response.data));
// Sleep for the backoff period
await new Promise(r => setTimeout(r, backoffPeriods[attempt] * 1000));
continue;
@ -88,7 +88,7 @@ async function uploadPayload(payload) {
// If the upload fails with 5xx then we assume it is a temporary problem
// 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 + '): (' + statusCode + ') ' + response.data);
core.error('Upload failed (' + requestID + '): (' + statusCode + ') ' + JSON.stringify(response.data));
return false;
}
}

File diff suppressed because one or more lines are too long