diff --git a/.github/workflows/push-to-dejacode.yml b/.github/workflows/push-to-dejacode.yml index 259baed..28e8549 100644 --- a/.github/workflows/push-to-dejacode.yml +++ b/.github/workflows/push-to-dejacode.yml @@ -22,4 +22,4 @@ jobs: env: DEJACODE_URL: ${{ secrets.DEJACODE_URL }} DEJACODE_API_KEY: ${{ secrets.DEJACODE_API_KEY }} - PROJECT_OUTPUTS: ${{ env.PROJECT_OUTPUTS }} + PROJECT_OUTPUT_DIRECTORY: ${{ env.PROJECT_OUTPUT_DIRECTORY }} diff --git a/action.yml b/action.yml index c329942..3ff1acc 100644 --- a/action.yml +++ b/action.yml @@ -85,12 +85,14 @@ runs: project_status=$(scanpipe status --project ${{ inputs.project-name }}) work_directory=$(echo "$project_status" | grep -oP 'Work directory:\s*\K[^\n]+') echo "PROJECT_WORK_DIRECTORY=$work_directory" >> $GITHUB_ENV + echo "PROJECT_INPUT_DIRECTORY=$work_directory/input" >> $GITHUB_ENV + echo "PROJECT_OUTPUT_DIRECTORY=$work_directory/output" >> $GITHUB_ENV - name: Copy input files to project work directory shell: bash run: | SOURCE_PATH="${{ inputs.inputs-path }}" - DESTINATION_PATH="${{ env.PROJECT_WORK_DIRECTORY }}/input/" + DESTINATION_PATH="${{ env.PROJECT_INPUT_DIRECTORY }}" if [ -d "$SOURCE_PATH" ]; then cp -r "$SOURCE_PATH"/* "$DESTINATION_PATH" fi @@ -106,7 +108,7 @@ runs: scanpipe output --no-color \ --project ${{ inputs.project-name }} \ --format ${{ inputs.output-formats }} - project_outputs=$(ls ${{ env.PROJECT_WORK_DIRECTORY }}/output/)) + project_outputs=$(ls ${{ env.PROJECT_OUTPUT_DIRECTORY }})) echo "PROJECT_OUTPUTS=$project_outputs" >> $GITHUB_ENV - name: Upload outputs @@ -114,4 +116,4 @@ runs: id: artifact-upload-step with: name: ${{ inputs.outputs-archive-name }} - path: ${{ env.PROJECT_WORK_DIRECTORY }}/output/* + path: ${{ env.PROJECT_OUTPUT_DIRECTORY }}/* diff --git a/scripts/push_to_dejacode.py b/scripts/push_to_dejacode.py index d92b27e..bd6dd65 100644 --- a/scripts/push_to_dejacode.py +++ b/scripts/push_to_dejacode.py @@ -21,6 +21,7 @@ # Visit https://github.com/nexB/scancode.io for support and download. from pathlib import Path +import uuid import requests import os @@ -68,13 +69,13 @@ def push_scan_to_product(files): if __name__ == "__main__": product_data = { "name": "Demo Push Product", - "version": "1.0", + "version": uuid.uuid4(), } product_uuid = create_product(product_data) # Replace by args - PROJECT_OUTPUTS = os.environ["PROJECT_OUTPUTS"] - scan_location = list(Path(PROJECT_OUTPUTS).glob("*.json"))[0] + PROJECT_OUTPUT_DIRECTORY = os.environ["PROJECT_OUTPUT_DIRECTORY"] + scan_location = list(Path(PROJECT_OUTPUT_DIRECTORY).glob("*.json"))[0] print(scan_location) files = {"upload_file": open(scan_location, "rb")}