Skip to content

Commit

Permalink
add exe to syft tool name in one place
Browse files Browse the repository at this point in the history
Signed-off-by: Will Murphy <[email protected]>
  • Loading branch information
willmurphyscode committed Nov 7, 2023
1 parent ecbabe4 commit bd5d548
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 28 deletions.
10 changes: 3 additions & 7 deletions dist/attachReleaseAssets/index.js

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

10 changes: 3 additions & 7 deletions dist/downloadSyft/index.js

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

10 changes: 3 additions & 7 deletions dist/runSyftAction/index.js

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

11 changes: 4 additions & 7 deletions src/github/SyftGithubAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import {
import { downloadSyftFromZip } from "./SyftDownloader";
import { stringify } from "./Util";

export const SYFT_BINARY_NAME = "syft";
export const SYFT_BINARY_NAME =
"syft" + (process.platform == "win32" ? ".exe" : "");
export const SYFT_VERSION = core.getInput("syft-version") || VERSION;

const PRIOR_ARTIFACT_ENV_VAR = "ANCHORE_SBOM_ACTION_PRIOR_ARTIFACT";
Expand Down Expand Up @@ -205,18 +206,14 @@ export async function downloadSyft(): Promise<string> {

await execute("sh", [installPath, "-d", "-b", syftBinaryPath, version]);

const installedPath = path.join(`${syftBinaryPath}`, `${name}`);
if (process.platform === "win32") {
return `${installedPath}.exe`;
}
return installedPath;
return path.join(`${syftBinaryPath}`, `${name}`);
}

/**
* Gets the Syft command to run via exec
*/
export async function getSyftCommand(): Promise<string> {
const name = SYFT_BINARY_NAME + (process.platform == "win32" ? ".exe" : "");
const name = SYFT_BINARY_NAME;
const version = SYFT_VERSION;

const sourceSyft = await downloadSyftFromZip(version);
Expand Down

0 comments on commit bd5d548

Please sign in to comment.