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 9507482
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
16 changes: 11 additions & 5 deletions lib/debug-artifacts.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/debug-artifacts.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 9507482

Please sign in to comment.