Skip to content

Commit 9507482

Browse files
committed
Avoid failing when debug artifacts can't be uploaded
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.
1 parent 35619fb commit 9507482

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

Diff for: lib/debug-artifacts.js

+11-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/debug-artifacts.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/debug-artifacts.ts

+16-10
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,22 @@ export async function uploadDebugArtifacts(
4545
);
4646
}
4747
}
48-
await artifact.create().uploadArtifact(
49-
sanitizeArifactName(`${artifactName}${suffix}`),
50-
toUpload.map((file) => path.normalize(file)),
51-
path.normalize(rootDir),
52-
{
53-
continueOnError: true,
54-
// ensure we don't keep the debug artifacts around for too long since they can be large.
55-
retentionDays: 7,
56-
},
57-
);
48+
49+
try {
50+
await artifact.create().uploadArtifact(
51+
sanitizeArifactName(`${artifactName}${suffix}`),
52+
toUpload.map((file) => path.normalize(file)),
53+
path.normalize(rootDir),
54+
{
55+
continueOnError: true,
56+
// ensure we don't keep the debug artifacts around for too long since they can be large.
57+
retentionDays: 7,
58+
},
59+
);
60+
} catch (e) {
61+
// A failure to upload debug artifacts should not fail the entire action.
62+
core.warning(`Failed to upload debug artifacts: ${e}`);
63+
}
5864
}
5965

6066
export async function uploadSarifDebugArtifact(

0 commit comments

Comments
 (0)