Skip to content

Commit 3a61940

Browse files
committed
Improve logging in uploadSarifArtifact
1 parent 850cc87 commit 3a61940

2 files changed

Lines changed: 33 additions & 27 deletions

File tree

‎lib/entry-points.js‎

Lines changed: 16 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/init-action-post-helper.ts‎

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -276,22 +276,25 @@ async function uploadSarifArtifact(
276276
prefix: string,
277277
failedSarif: FailedSarifInfo,
278278
): Promise<UploadFailedSarifResult> {
279-
logger.info(
280-
`Uploading failed SARIF file ${failedSarif.sarifFile} as artifact`,
281-
);
282-
283-
const gitHubVersion = await getGitHubVersion();
284-
const client = await getArtifactUploaderClient(logger, gitHubVersion.type);
279+
logger.startGroup(`Uploading failed SARIF file as artifact`);
280+
logger.info(`Uploading '${failedSarif.sarifFile}' as artifact`);
285281

286-
const suffix = getArtifactSuffix(actionsUtil.getOptionalInput("matrix"));
287-
const name = sanitizeArtifactName(`${prefix}-${suffix}`);
288-
await client.uploadArtifact(
289-
name,
290-
[path.normalize(failedSarif.sarifFile)],
291-
path.normalize(".."),
292-
);
282+
try {
283+
const gitHubVersion = await getGitHubVersion();
284+
const client = await getArtifactUploaderClient(logger, gitHubVersion.type);
285+
286+
const suffix = getArtifactSuffix(actionsUtil.getOptionalInput("matrix"));
287+
const name = sanitizeArtifactName(`${prefix}-${suffix}`);
288+
await client.uploadArtifact(
289+
name,
290+
[path.normalize(failedSarif.sarifFile)],
291+
path.normalize(".."),
292+
);
293293

294-
return { sarifID: name };
294+
return { sarifID: name };
295+
} finally {
296+
logger.endGroup();
297+
}
295298
}
296299

297300
/**

0 commit comments

Comments
 (0)