Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File input not being passed properly to Syft invocation #385

Merged
merged 1 commit into from Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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