Skip to content

Commit

Permalink
Avoid failing when debug artifacts can't be uploaded
Browse files Browse the repository at this point in the history
Failing to upload debug artifacts should not fail the action since
it is possible that the action has already succeeded by the time this
failure occurs.
  • Loading branch information
aeisenberg committed Jun 20, 2024
1 parent 35619fb commit 24e7d63
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/debug-artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,22 @@ export async function uploadDebugArtifacts(
);
}
}
await artifact.create().uploadArtifact(
sanitizeArifactName(`${artifactName}${suffix}`),
toUpload.map((file) => path.normalize(file)),
path.normalize(rootDir),
{
continueOnError: true,
// ensure we don't keep the debug artifacts around for too long since they can be large.
retentionDays: 7,
},
);

try {
await artifact.create().uploadArtifact(
sanitizeArifactName(`${artifactName}${suffix}`),
toUpload.map((file) => path.normalize(file)),
path.normalize(rootDir),
{
continueOnError: true,
// ensure we don't keep the debug artifacts around for too long since they can be large.
retentionDays: 7,
},
);
} catch (e) {
// A failure to upload debug artifacts should not fail the entire action.
core.warning(`Failed to upload debug artifacts: ${e}`);
}
}

export async function uploadSarifDebugArtifact(
Expand Down

0 comments on commit 24e7d63

Please sign in to comment.