Emit log message, capture non-PR runs

This commit is contained in:
Angela P Wen
2024-01-16 15:16:48 -08:00
parent b0b38b29b2
commit 648a31a015
3 changed files with 18 additions and 13 deletions
+8 -5
View File
@@ -115,11 +115,14 @@ async function run(uploadDatabaseBundleDebugArtifact, uploadLogsDebugArtifact, p
throw new Error("Expected to upload a failed SARIF file for this CodeQL code scanning run, " +
`but the result was instead ${error}.`);
}
// We do not delete uploaded SARIFs if we're on a fork, as we're missing the
// appropriate permissions.
if (process.env["CODEQL_ACTION_EXPECT_UPLOAD_FAILED_SARIF"] === "true" &&
github.context.payload.pull_request?.head.repo.fork === false) {
await removeUploadedSarif(uploadFailedSarifResult, logger);
if (process.env["CODEQL_ACTION_EXPECT_UPLOAD_FAILED_SARIF"] === "true") {
if (!github.context.payload.pull_request?.head.repo.fork) {
await removeUploadedSarif(uploadFailedSarifResult, logger);
}
else {
logger.info("Skipping deletion of failed SARIF because the workflow was triggered from a fork of " +
"codeql-action and doesn't have the appropriate permissions for deletion.");
}
}
// Upload appropriate Actions artifacts for debugging
if (config.debugMode) {
File diff suppressed because one or more lines are too long
+9 -7
View File
@@ -184,13 +184,15 @@ export async function run(
);
}
// We do not delete uploaded SARIFs if we're on a fork, as we're missing the
// appropriate permissions.
if (
process.env["CODEQL_ACTION_EXPECT_UPLOAD_FAILED_SARIF"] === "true" &&
github.context.payload.pull_request?.head.repo.fork === false
) {
await removeUploadedSarif(uploadFailedSarifResult, logger);
if (process.env["CODEQL_ACTION_EXPECT_UPLOAD_FAILED_SARIF"] === "true") {
if (!github.context.payload.pull_request?.head.repo.fork) {
await removeUploadedSarif(uploadFailedSarifResult, logger);
} else {
logger.info(
"Skipping deletion of failed SARIF because the workflow was triggered from a fork of " +
"codeql-action and doesn't have the appropriate permissions for deletion.",
);
}
}
// Upload appropriate Actions artifacts for debugging