Skip to content

Commit

Permalink
fix: set "json" output variable instead of "report" (#222)
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Klopfenstein <kklopfenstein@users.noreply.github.com>
  • Loading branch information
kklopfenstein authored Mar 30, 2023
1 parent 9d425e6 commit 4be3c24
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ async function runScan({ source, failBuild, severityCutoff, onlyFixed, outputFor
case "json": {
const REPORT_FILE = "./results.json";
fs.writeFileSync(REPORT_FILE, cmdOutput);
out.report = REPORT_FILE;
out.json = REPORT_FILE;
break;
}
default: // e.g. table
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ async function runScan({ source, failBuild, severityCutoff, onlyFixed, outputFor
case "json": {
const REPORT_FILE = "./results.json";
fs.writeFileSync(REPORT_FILE, cmdOutput);
out.report = REPORT_FILE;
out.json = REPORT_FILE;
break;
}
default: // e.g. table
Expand Down
3 changes: 2 additions & 1 deletion tests/action_args.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const exec = require("@actions/exec");
jest.setTimeout(30000);

describe("Github action args", () => {
it("runs without sarif report", async () => {
it("runs with json report", async () => {
const inputs = {
image: "",
path: "tests/fixtures/npm-project",
Expand Down Expand Up @@ -36,6 +36,7 @@ describe("Github action args", () => {
});

expect(outputs["sarif"]).toBeFalsy();
expect(outputs["json"]).toBe("./results.json");

spyInput.mockRestore();
spyOutput.mockRestore();
Expand Down

0 comments on commit 4be3c24

Please sign in to comment.