E585 fix: file input not being passed properly to syft invocation (#385) · anchore/sbom-action@06e1094 · GitHub
[go: up one dir, main page]

Skip to content

Commit 06e1094

Browse files
authored
fix: file input not being passed properly to syft invocation (#385)
1 parent f4e264e commit 06e1094

File tree

5 files changed

+52
-0
lines changed

5 files changed

+52
-0
lines changed

dist/attachReleaseAssets/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/downloadSyft/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/runSyftAction/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/github/SyftGithubAction.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ export async function runSyftAction(): Promise<void> {
339339
const output = await executeSyft({
340340
input: {
341341
path: core.getInput("path"),
342+
file: core.getInput("file"),
342343
image: core.getInput("image"),
343344
},
344345
format: getSbomFormat(),

tests/SyftGithubAction.test.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,54 @@ describe("Action", () => {
5353
expect(assets.length).toBe(0);
5454
});
5555

56+
it("runs with image input", async () => {
57+
setData({
58+
inputs: {
59+
image: "some-image:latest",
60+
},
61+
});
62+
63+
await action.runSyftAction();
64+
65+
const { args } = data.execArgs;
66+
67+
expect(args).toBeDefined()
68+
expect(args.length > 2).toBeTruthy();
69+
expect(args[2]).toBe("some-image:latest")
70+
});
71+
72+
it("runs with path input", async () => {
73+
setData({
74+
inputs: {
75+
path: "some-path",
76+
},
77+
});
78+
79+
await action.runSyftAction();
80+
81+
const { args } = data.execArgs;
82+
83+
expect(args).toBeDefined()
84+
expect(args.length > 2).toBeTruthy();
85+
expect(args[2]).toBe("dir:some-path")
86+
});
87+
88+
it("runs with file input", async () => {
89+
setData({
90+
inputs: {
91+
file: "some-file.jar",
92+
},
93+
});
94+
95+
await action.runSyftAction();
96+
97+
const { args } = data.execArgs;
98+
99+
expect(args).toBeDefined()
100+
expect(args.length > 2).toBeTruthy();
101+
expect(args[2]).toBe("file:some-file.jar")
102+
});
103+
56104
it("runs with release uploads inputs", async () => {
57105
const outputFile = `${fs.mkdtempSync(
58106
path.join(os.tmpdir(), "sbom-action-")

0 commit comments

Comments
 (0)
0