Skip to content

Commit

Permalink
chore: Changes & fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rsenden committed Sep 21, 2023
1 parent 25d88d4 commit 358e860
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
4 changes: 4 additions & 0 deletions setup/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

cd setup && NODE_OPTIONS=--openssl-legacy-provider npm run build && git add dist/
4 changes: 3 additions & 1 deletion setup/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6599,7 +6599,9 @@ function installFcli() {
core.info(`Using fcli ${fcliVersion} from cache`);
}
else {
const baseUrl = `https://github.com/fortify-ps/fcli/releases/download/${fcliVersion}`;
const baseUrl = fcliVersion === 'latest'
? 'https://github.com/fortify/fcli/releases/latest/download'
: `https://github.com/fortify/fcli/releases/download/${fcliVersion}`;
let installPath = '/opt/fortify/fcli';
core.info(`Installing fcli ${fcliVersion} from ${baseUrl}`);
// TODO Verify download hashes
Expand Down
14 changes: 8 additions & 6 deletions setup/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import * as exec from '@actions/exec';
async function installFcli(): Promise<void> {
const fcliVersion = getFcliVersion();
let cachedPath = tc.find('fcli', fcliVersion);
if ( cachedPath ) {
if (cachedPath) {
core.info(`Using fcli ${fcliVersion} from cache`);
} else {
const baseUrl = `https://github.com/fortify-ps/fcli/releases/download/${fcliVersion}`
const baseUrl = fcliVersion === 'latest'
? 'https://github.com/fortify/fcli/releases/latest/download'
: `https://github.com/fortify/fcli/releases/download/${fcliVersion}`
let installPath = '/opt/fortify/fcli';
core.info(`Installing fcli ${fcliVersion} from ${baseUrl}`);
// TODO Verify download hashes
Expand Down Expand Up @@ -46,9 +48,9 @@ function getFcliVersion(): string {
}

async function installTool(toolName: string, toolVersion: string): Promise<void> {
if ( toolVersion!=='none') {
if (toolVersion !== 'none') {
let installPath = tc.find(toolName, toolVersion);
if ( installPath ) {
if (installPath) {
core.info(`Using ${toolName} ${toolVersion} from cache`);
} else {
core.info(`Installing ${toolName} ${toolVersion}`);
Expand All @@ -61,10 +63,10 @@ async function installTool(toolName: string, toolVersion: string): Promise<void>
}

async function main(): Promise<void> {
const tools = [ 'sc-client', 'fod-uploader', 'vuln-exporter']
const tools = ['sc-client', 'fod-uploader', 'vuln-exporter']
try {
await installFcli();
for ( const tool of tools ) {
for (const tool of tools) {
await installTool(tool, core.getInput(tool))
}
} catch (err) {
Expand Down

0 comments on commit 358e860

Please sign in to comment.