Skip to content

Commit

Permalink
Only upload combined SARIF files when env var is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Koen Vlaswinkel committed Mar 25, 2024
1 parent 3c4b8bc commit 82b82e5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/analyze-action-post.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/analyze-action-post.js.map

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

3 changes: 2 additions & 1 deletion lib/upload-sarif-action-post-helper.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/upload-sarif-action-post-helper.js.map

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

5 changes: 5 additions & 0 deletions src/analyze-action-post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
5 changes: 4 additions & 1 deletion src/upload-sarif-action-post-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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...",
);
Expand Down

0 comments on commit 82b82e5

Please sign in to comment.