Skip to content

Commit

Permalink
fix: file input not being passed properly to syft invocation
Browse files Browse the repository at this point in the history
Signed-off-by: Keith Zantow <kzantow@gmail.com>
  • Loading branch information
kzantow committed Oct 31, 2022
1 parent b7e8507 commit a2404e0
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
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
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 a2404e0

Please sign in to comment.