diff --git a/.github/workflows/map-deploy-to-develop.yml b/.github/workflows/map-deploy-to-develop.yml index 09ab26e..61eb2de 100644 --- a/.github/workflows/map-deploy-to-develop.yml +++ b/.github/workflows/map-deploy-to-develop.yml @@ -13,9 +13,7 @@ jobs: - uses: ./ with: - pipelines: "map_deploy_to_develop" + pipelines: "map_deploy_to_develop:Java" input-urls: https://github.com/aboutcode-org/scancode.io/raw/main/scanpipe/tests/data/d2d/jars/from-flume-ng-node-1.9.0.zip#from https://github.com/aboutcode-org/scancode.io/raw/main/scanpipe/tests/data/d2d/jars/to-flume-ng-node-1.9.0.zip#to - env: - PURLDB_URL: https://public.purldb.io/ diff --git a/README.md b/README.md index 15e4086..7a8e22d 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Workflows. - [Scan repo codebase](#scan-repo-codebase) - [Run a specific pipeline](#run-a-specific-pipeline) - [Run multiple pipelines](#run-multiple-pipelines) + - [Specify pipeline options](#specify-pipeline-options) - [Choose the output formats](#choose-the-output-formats) - [Provide download URLs inputs](#provide-download-urls-inputs) - [Fetch pipelines inputs](#fetch-pipelines-inputs) @@ -123,6 +124,17 @@ steps: VULNERABLECODE_URL: https://public.vulnerablecode.io/ ``` +### Specify pipeline options + +Use the `pipeline_name:option1,option2` syntax to select optional steps for the +`map_deploy_to_develop` pipeline + +```yaml +- uses: aboutcode-org/scancode-action@beta + with: + pipelines: "map_deploy_to_develop:Java,JavaScript" +``` + #### Configuring `find_vulnerabilities` Pipeline The `find_vulnerabilities` pipeline requires access to a VulnerableCode instance, diff --git a/action.yml b/action.yml index 5c0e93b..1c13ff0 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,7 @@ inputs: default: "json xlsx spdx cyclonedx" inputs-path: description: "Relative path within the $GITHUB_WORKSPACE for pipeline inputs" - default: "${{ github.workspace }}/scancode-inputs" + default: "scancode-inputs" input-urls: description: "Provide one or more URLs to download for the pipeline run execution." required: false @@ -116,14 +116,30 @@ runs: echo "PROJECT_WORK_DIRECTORY=$work_directory" >> $GITHUB_ENV - name: Copy input files to project work directory + if: ${{ !inputs.input-urls }} shell: bash run: | SOURCE_PATH="${{ inputs.inputs-path }}" + [[ "$SOURCE_PATH" != /* ]] && SOURCE_PATH="${{ github.workspace }}/$SOURCE_PATH" DESTINATION_PATH="${{ env.PROJECT_WORK_DIRECTORY }}/input/" + mkdir -p "$DESTINATION_PATH" + if [ -d "$SOURCE_PATH" ]; then - cp -r "$SOURCE_PATH"/* "$DESTINATION_PATH" + if [ "$(ls -A "$SOURCE_PATH")" ]; then + echo "Copying contents of directory: $SOURCE_PATH → $DESTINATION_PATH" + cp -r "$SOURCE_PATH"/* "$DESTINATION_PATH" + else + echo "Input directory '$SOURCE_PATH' is empty, nothing to copy." + fi + else + echo "Copying file: $SOURCE_PATH → $DESTINATION_PATH" + cp "$SOURCE_PATH" "$DESTINATION_PATH" fi + echo "" + echo "Input files now in: $DESTINATION_PATH" + ls -lh "$DESTINATION_PATH" + - name: Run the pipelines shell: bash run: scanpipe execute --project ${{ inputs.project-name }} --no-color