From 46b5347c2f7595d19063bb3d3226732526b76dcc Mon Sep 17 00:00:00 2001 From: Agustin Isasmendi Date: Thu, 25 Jan 2024 16:37:07 +0100 Subject: [PATCH] SCP-79 Adds parameter 'with-dependencies' --- .github/workflows/test-action.yml | 1 + action.yml | 3 +++ dist/index.js | 7 ++++--- src/app.input.ts | 1 + src/services/scan.service.ts | 4 ++-- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index 12db4ef..15199a6 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -26,6 +26,7 @@ jobs: uses: ./ with: # sbom-ignore: 'scanoss-ignore.json' + with-dependencies: true github-token: ${{ secrets.GITHUB_TOKEN }} - name: Print stdout scan command diff --git a/action.yml b/action.yml index db56e75..8c5beaf 100644 --- a/action.yml +++ b/action.yml @@ -28,6 +28,9 @@ inputs: api-url: description: 'SCANOSS API URL (optional - default: https://osskb.org/api/scan/direct)' required: false + with-dependencies: + description: Scan dependencies (optional - default false) + required: false # Define your outputs here. outputs: diff --git a/dist/index.js b/dist/index.js index 2731fc1..eb2206f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -30178,7 +30178,7 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.API_URL = exports.API_KEY = exports.SBOM_IGNORE = exports.SBOM_INDENTIFY = exports.OUTPUT_PATH = exports.REPO_DIR = void 0; +exports.WITH_DEPENDENCIES = exports.API_URL = exports.API_KEY = exports.SBOM_IGNORE = exports.SBOM_INDENTIFY = exports.OUTPUT_PATH = exports.REPO_DIR = void 0; const core = __importStar(__nccwpck_require__(2186)); exports.REPO_DIR = process.env.GITHUB_WORKSPACE; exports.OUTPUT_PATH = core.getInput('output-path'); @@ -30186,6 +30186,7 @@ exports.SBOM_INDENTIFY = core.getInput('sbom-identify'); exports.SBOM_IGNORE = core.getInput('sbom-ignore'); exports.API_KEY = core.getInput('api-key'); exports.API_URL = core.getInput('api-url'); +exports.WITH_DEPENDENCIES = core.getInput('with-dependencies'); /***/ }), @@ -30568,8 +30569,8 @@ exports.commandBuilder = void 0; const input = __importStar(__nccwpck_require__(483)); function commandBuilder() { return `docker run -v "${input.REPO_DIR}":"/scanoss" ghcr.io/scanoss/scanoss-py:v1.9.0 scan . - --dependencies - --output ${input.OUTPUT_PATH} + --output ${input.OUTPUT_PATH} + ${input.WITH_DEPENDENCIES ? `--dependencies` : ''} ${input.SBOM_INDENTIFY ? `--identify ${input.SBOM_INDENTIFY}` : ''} ${input.SBOM_IGNORE ? `--ignore ${input.SBOM_IGNORE}` : ''} ${input.API_URL ? `--apiurl ${input.API_URL}` : ''} diff --git a/src/app.input.ts b/src/app.input.ts index 98c093a..de1536e 100644 --- a/src/app.input.ts +++ b/src/app.input.ts @@ -6,3 +6,4 @@ export const SBOM_INDENTIFY = core.getInput('sbom-identify'); export const SBOM_IGNORE = core.getInput('sbom-ignore'); export const API_KEY = core.getInput('api-key'); export const API_URL = core.getInput('api-url'); +export const WITH_DEPENDENCIES = core.getInput('with-dependencies'); diff --git a/src/services/scan.service.ts b/src/services/scan.service.ts index 5cc03f5..f84f785 100644 --- a/src/services/scan.service.ts +++ b/src/services/scan.service.ts @@ -2,8 +2,8 @@ import * as input from '../app.input'; export function commandBuilder(): string { return `docker run -v "${input.REPO_DIR}":"/scanoss" ghcr.io/scanoss/scanoss-py:v1.9.0 scan . - --dependencies - --output ${input.OUTPUT_PATH} + --output ${input.OUTPUT_PATH} + ${input.WITH_DEPENDENCIES ? `--dependencies` : ''} ${input.SBOM_INDENTIFY ? `--identify ${input.SBOM_INDENTIFY}` : ''} ${input.SBOM_IGNORE ? `--ignore ${input.SBOM_IGNORE}` : ''} ${input.API_URL ? `--apiurl ${input.API_URL}` : ''}