Only upload combined SARIF files when env var is set

This commit is contained in:
Koen Vlaswinkel 2024-03-25 10:12:31 +01:00
parent 3c4b8bc120
commit 82b82e58c0
6 changed files with 17 additions and 4 deletions

View file

@ -7,11 +7,16 @@ import * as core from "@actions/core";
import * as analyzeActionPostHelper from "./analyze-action-post-helper";
import * as debugArtifacts from "./debug-artifacts";
import * as uploadSarifActionPostHelper from "./upload-sarif-action-post-helper";
import { wrapError } from "./util";
async function runWrapper() {
try {
await analyzeActionPostHelper.run(debugArtifacts.uploadSarifDebugArtifact);
// Also run the upload-sarif post action since we're potentially running
// the same steps in the analyze action.
await uploadSarifActionPostHelper.run(debugArtifacts.uploadDebugArtifacts);
} catch (error) {
core.setFailed(
`analyze post-action step failed: ${wrapError(error).message}`,

View file

@ -15,7 +15,10 @@ export async function run(
const tempDir = actionsUtil.getTemporaryDirectory();
// Upload Actions SARIF artifacts for debugging
if (core.isDebug()) {
if (
core.isDebug() &&
process.env["CODEQL_ACTION_DEBUG_COMBINED_SARIF"] === "true"
) {
core.info(
"Debug mode is on. Uploading available combined SARIF files as Actions debugging artifact...",
);