Skip to content

Commit

Permalink
fix: file input not being passed properly to syft invocation (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
kzantow authored Nov 4, 2022
1 parent f4e264e commit 06e1094
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions dist/attachReleaseAssets/index.js

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

1 change: 1 addition & 0 deletions dist/downloadSyft/index.js

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

1 change: 1 addition & 0 deletions dist/runSyftAction/index.js

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

1 change: 1 addition & 0 deletions src/github/SyftGithubAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ export async function runSyftAction(): Promise<void> {
const output = await executeSyft({
input: {
path: core.getInput("path"),
file: core.getInput("file"),
image: core.getInput("image"),
},
format: getSbomFormat(),
Expand Down
48 changes: 48 additions & 0 deletions tests/SyftGithubAction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,54 @@ describe("Action", () => {
expect(assets.length).toBe(0);
});

it("runs with image input", async () => {
setData({
inputs: {
image: "some-image:latest",
},
});

await action.runSyftAction();

const { args } = data.execArgs;

expect(args).toBeDefined()
expect(args.length > 2).toBeTruthy();
expect(args[2]).toBe("some-image:latest")
});

it("runs with path input", async () => {
setData({
inputs: {
path: "some-path",
},
});

await action.runSyftAction();

const { args } = data.execArgs;

expect(args).toBeDefined()
expect(args.length > 2).toBeTruthy();
expect(args[2]).toBe("dir:some-path")
});

it("runs with file input", async () => {
setData({
inputs: {
file: "some-file.jar",
},
});

await action.runSyftAction();

const { args } = data.execArgs;

expect(args).toBeDefined()
expect(args.length > 2).toBeTruthy();
expect(args[2]).toBe("file:some-file.jar")
});

it("runs with release uploads inputs", async () => {
const outputFile = `${fs.mkdtempSync(
path.join(os.tmpdir(), "sbom-action-")
Expand Down

0 comments on commit 06e1094

Please sign in to comment.