From 59e3d9f1d270a768fe05802dafa9b84f16e473be Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Tue, 28 Mar 2023 14:07:34 -0100 Subject: [PATCH 01/80] Basesine for the action --- .gitignore | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ action.yml | 39 ++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 .gitignore create mode 100644 action.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..214c3bd --- /dev/null +++ b/.gitignore @@ -0,0 +1,98 @@ +# Ignore node_modules, ncc is used to compile nodejs modules into a single file in the releases branch +node_modules/ +__tests__/runner/* + +# Ignore js files that are transpiled from ts files in src/ +lib/ + +# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# Editor +.idea diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..72c9032 --- /dev/null +++ b/action.yml @@ -0,0 +1,39 @@ +name: "ScanCode action" +description: "Run ScanCode.io pipelines in your workflows" +inputs: + pipeline-name: + description: "Name of the pipeline" + required: true + default: "scan_codebase" + project-name: + description: "Name of the project" + required: true + default: "TODO" + python-version: + description: "Python version" + default: "3.11" + output-formats: + description: "Output formats" + default: "json xlsx spdx cyclonedx" +runs: + using: "composite" + steps: + - uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python-version }} + - name: Install and setup ScanCode.io + run: | + pip install scancodeio + scanpipe migrate + - name: Create project and run the ${{ inputs.pipeline-name }} pipeline + run: scanpipe create-project ${{ inputs.project-name }} + --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip + --pipeline ${{ inputs.pipeline-name }} + --execute + - name: Generate outputs + run: scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} + - name: Upload outputs + uses: actions/upload-artifact@v3 + with: + name: scan-outputs + path: ${{ github.action_path }}/**/output/* From 4eb8052d61cc0a820017ef0b7437d35d61b3fe71 Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Tue, 28 Mar 2023 14:23:12 -0100 Subject: [PATCH 02/80] Test workflow for the scan action --- .github/workflows/main.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..dfee321 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,10 @@ +on: [push] + +jobs: + scan: + runs-on: ubuntu-latest + name: ScanCode-action + steps: + - uses: nexB/scancode-action@alpha + with: + project-name: "test" From f9928dabe5a2ec7a2fe949580d2b10d354be085d Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Tue, 28 Mar 2023 14:27:38 -0100 Subject: [PATCH 03/80] Add missing shell: bash Signed-off-by: Thomas Druez --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 72c9032..9be21f4 100644 --- a/action.yml +++ b/action.yml @@ -22,6 +22,7 @@ runs: with: python-version: ${{ inputs.python-version }} - name: Install and setup ScanCode.io + shell: bash run: | pip install scancodeio scanpipe migrate From c23cb09d16fdde5240bb2e9c9a190a5ac8a92d4d Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Tue, 28 Mar 2023 14:28:21 -0100 Subject: [PATCH 04/80] Add missing shell: bash Signed-off-by: Thomas Druez --- action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/action.yml b/action.yml index 9be21f4..0a63e95 100644 --- a/action.yml +++ b/action.yml @@ -27,11 +27,13 @@ runs: pip install scancodeio scanpipe migrate - name: Create project and run the ${{ inputs.pipeline-name }} pipeline + shell: bash run: scanpipe create-project ${{ inputs.project-name }} --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip --pipeline ${{ inputs.pipeline-name }} --execute - name: Generate outputs + shell: bash run: scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} - name: Upload outputs uses: actions/upload-artifact@v3 From 5946fd56fa39231ea305b4b9a596bfbad3a6f64d Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Tue, 28 Mar 2023 14:39:11 -0100 Subject: [PATCH 05/80] Attempt to set env Signed-off-by: Thomas Druez --- action.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/action.yml b/action.yml index 0a63e95..9bc1765 100644 --- a/action.yml +++ b/action.yml @@ -18,6 +18,12 @@ inputs: runs: using: "composite" steps: + - name: Set the env + shell: bash + run: | + export SECRET_KEY="TEST" + export SCANCODEIO_DB_ENGINE"django.db.backends.sqlite3" + export SCANCODEIO_DB_NAME="sqlite3.db" - uses: actions/setup-python@v4 with: python-version: ${{ inputs.python-version }} From 6cbb1f1e16ded136560da70e799b240cbefa2828 Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Tue, 28 Mar 2023 14:41:55 -0100 Subject: [PATCH 06/80] Attempt to set env Signed-off-by: Thomas Druez --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 9bc1765..912874c 100644 --- a/action.yml +++ b/action.yml @@ -22,7 +22,7 @@ runs: shell: bash run: | export SECRET_KEY="TEST" - export SCANCODEIO_DB_ENGINE"django.db.backends.sqlite3" + export SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" export SCANCODEIO_DB_NAME="sqlite3.db" - uses: actions/setup-python@v4 with: From 4e59ed228deda9bfb280120b889421c950c6f356 Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Tue, 28 Mar 2023 14:46:12 -0100 Subject: [PATCH 07/80] Attempt to set env Signed-off-by: Thomas Druez --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 912874c..7200d3b 100644 --- a/action.yml +++ b/action.yml @@ -31,10 +31,10 @@ runs: shell: bash run: | pip install scancodeio - scanpipe migrate + SECRET_KEY="A" scanpipe migrate - name: Create project and run the ${{ inputs.pipeline-name }} pipeline shell: bash - run: scanpipe create-project ${{ inputs.project-name }} + run: SECRET_KEY="A" scanpipe create-project ${{ inputs.project-name }} --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip --pipeline ${{ inputs.pipeline-name }} --execute From 86716698afa17e8082f688e55f5cbdafb14d1ecb Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Tue, 28 Mar 2023 14:46:55 -0100 Subject: [PATCH 08/80] Attempt to set env Signed-off-by: Thomas Druez --- action.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 7200d3b..8ba558a 100644 --- a/action.yml +++ b/action.yml @@ -17,13 +17,12 @@ inputs: default: "json xlsx spdx cyclonedx" runs: using: "composite" + env: + SECRET_KEY: "abc" steps: - - name: Set the env + - name: Check the env shell: bash - run: | - export SECRET_KEY="TEST" - export SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" - export SCANCODEIO_DB_NAME="sqlite3.db" + run: echo $SECRET_KEY - uses: actions/setup-python@v4 with: python-version: ${{ inputs.python-version }} From 54e9ea2aa8735847a0add3d605045dfad3f0c811 Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Tue, 28 Mar 2023 14:50:16 -0100 Subject: [PATCH 09/80] Attempt to set env Signed-off-by: Thomas Druez --- action.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/action.yml b/action.yml index 8ba558a..02eced3 100644 --- a/action.yml +++ b/action.yml @@ -17,12 +17,7 @@ inputs: default: "json xlsx spdx cyclonedx" runs: using: "composite" - env: - SECRET_KEY: "abc" steps: - - name: Check the env - shell: bash - run: echo $SECRET_KEY - uses: actions/setup-python@v4 with: python-version: ${{ inputs.python-version }} From 037ab7f7ba538b1589025854e9b5bab166fd45ce Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Tue, 28 Mar 2023 14:54:17 -0100 Subject: [PATCH 10/80] Attempt to set env Signed-off-by: Thomas Druez --- action.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 02eced3..d8a7d5d 100644 --- a/action.yml +++ b/action.yml @@ -25,13 +25,21 @@ runs: shell: bash run: | pip install scancodeio - SECRET_KEY="A" scanpipe migrate + scanpipe migrate + env: + SECRET_KEY: "abc" + SCANCODEIO_DB_ENGINE: "django.db.backends.sqlite3" + SCANCODEIO_DB_NAME: "sqlite3.db" - name: Create project and run the ${{ inputs.pipeline-name }} pipeline shell: bash - run: SECRET_KEY="A" scanpipe create-project ${{ inputs.project-name }} + run: scanpipe create-project ${{ inputs.project-name }} --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip --pipeline ${{ inputs.pipeline-name }} --execute + env: + SECRET_KEY: "abc" + SCANCODEIO_DB_ENGINE: "django.db.backends.sqlite3" + SCANCODEIO_DB_NAME: "sqlite3.db" - name: Generate outputs shell: bash run: scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} From 2c94c41a1e54d44a3b2cb2efc151e54d0c4704ce Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Tue, 28 Mar 2023 14:59:56 -0100 Subject: [PATCH 11/80] Attempt to set env Signed-off-by: Thomas Druez --- action.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/action.yml b/action.yml index d8a7d5d..ddbc72d 100644 --- a/action.yml +++ b/action.yml @@ -25,24 +25,16 @@ runs: shell: bash run: | pip install scancodeio - scanpipe migrate - env: - SECRET_KEY: "abc" - SCANCODEIO_DB_ENGINE: "django.db.backends.sqlite3" - SCANCODEIO_DB_NAME: "sqlite3.db" + SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe migrate - name: Create project and run the ${{ inputs.pipeline-name }} pipeline shell: bash - run: scanpipe create-project ${{ inputs.project-name }} + run: SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe create-project ${{ inputs.project-name }} --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip --pipeline ${{ inputs.pipeline-name }} --execute - env: - SECRET_KEY: "abc" - SCANCODEIO_DB_ENGINE: "django.db.backends.sqlite3" - SCANCODEIO_DB_NAME: "sqlite3.db" - name: Generate outputs shell: bash - run: scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} + run: SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} - name: Upload outputs uses: actions/upload-artifact@v3 with: From 6d3ebcaaa8fdc24f57789ce404a23ff4d701336e Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Tue, 28 Mar 2023 15:04:26 -0100 Subject: [PATCH 12/80] Single format Signed-off-by: Thomas Druez --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dfee321..a384531 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,3 +8,4 @@ jobs: - uses: nexB/scancode-action@alpha with: project-name: "test" + output-formats: "json" From 045c360363ae644f814c82a4f095c9ec73a4353a Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Tue, 28 Mar 2023 15:19:30 -0100 Subject: [PATCH 13/80] Debug upload Signed-off-by: Thomas Druez --- action.yml | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/action.yml b/action.yml index ddbc72d..9f55e37 100644 --- a/action.yml +++ b/action.yml @@ -18,25 +18,36 @@ inputs: runs: using: "composite" steps: - - uses: actions/setup-python@v4 - with: - python-version: ${{ inputs.python-version }} - - name: Install and setup ScanCode.io + - name: path = ${{ github.workspace }} shell: bash run: | - pip install scancodeio - SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe migrate - - name: Create project and run the ${{ inputs.pipeline-name }} pipeline - shell: bash - run: SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe create-project ${{ inputs.project-name }} - --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip - --pipeline ${{ inputs.pipeline-name }} - --execute - - name: Generate outputs - shell: bash - run: SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} + mkdir -p /tmp/tmpzjp3x9i0/projects/test-5559b14b/output/ + touch /tmp/tmpzjp3x9i0/projects/test-5559b14b/output/results-2023-03-28-16-10-02.json - name: Upload outputs uses: actions/upload-artifact@v3 with: name: scan-outputs - path: ${{ github.action_path }}/**/output/* + path: /tmp/**/projects/**/output/* + +# - uses: actions/setup-python@v4 +# with: +# python-version: ${{ inputs.python-version }} +# - name: Install and setup ScanCode.io +# shell: bash +# run: | +# pip install scancodeio +# SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe migrate +# - name: Create project and run the ${{ inputs.pipeline-name }} pipeline +# shell: bash +# run: SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe create-project ${{ inputs.project-name }} +# --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip +# --pipeline ${{ inputs.pipeline-name }} +# --execute +# - name: Generate outputs +# shell: bash +# run: SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} +# - name: Upload outputs +# uses: actions/upload-artifact@v3 +# with: +# name: scan-outputs +# path: ${{ github.action_path }}/**/output/* From cde5cad7134b5019131ba41ee8b630b6d1c2e9b3 Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Tue, 28 Mar 2023 15:22:30 -0100 Subject: [PATCH 14/80] Debug upload Signed-off-by: Thomas Druez --- action.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/action.yml b/action.yml index 9f55e37..ad19c4a 100644 --- a/action.yml +++ b/action.yml @@ -18,17 +18,9 @@ inputs: runs: using: "composite" steps: - - name: path = ${{ github.workspace }} + - name: path shell: bash - run: | - mkdir -p /tmp/tmpzjp3x9i0/projects/test-5559b14b/output/ - touch /tmp/tmpzjp3x9i0/projects/test-5559b14b/output/results-2023-03-28-16-10-02.json - - name: Upload outputs - uses: actions/upload-artifact@v3 - with: - name: scan-outputs - path: /tmp/**/projects/**/output/* - + run: echo ${{ github.workspace }} # - uses: actions/setup-python@v4 # with: # python-version: ${{ inputs.python-version }} From 1ec7c0cf7e8cb875014496983a89025318719fec Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 13:30:50 -0700 Subject: [PATCH 15/80] Re-enable all the steps Signed-off-by: tdruez --- .github/workflows/main.yml | 3 +-- action.yml | 47 ++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a384531..04522b0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,5 +7,4 @@ jobs: steps: - uses: nexB/scancode-action@alpha with: - project-name: "test" - output-formats: "json" + output-formats: "json xlsx spdx cyclonedx" diff --git a/action.yml b/action.yml index ad19c4a..9d092bc 100644 --- a/action.yml +++ b/action.yml @@ -8,7 +8,7 @@ inputs: project-name: description: "Name of the project" required: true - default: "TODO" + default: "scancode-action" python-version: description: "Python version" default: "3.11" @@ -18,28 +18,25 @@ inputs: runs: using: "composite" steps: - - name: path + - uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python-version }} + - name: Install and setup ScanCode.io shell: bash - run: echo ${{ github.workspace }} -# - uses: actions/setup-python@v4 -# with: -# python-version: ${{ inputs.python-version }} -# - name: Install and setup ScanCode.io -# shell: bash -# run: | -# pip install scancodeio -# SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe migrate -# - name: Create project and run the ${{ inputs.pipeline-name }} pipeline -# shell: bash -# run: SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe create-project ${{ inputs.project-name }} -# --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip -# --pipeline ${{ inputs.pipeline-name }} -# --execute -# - name: Generate outputs -# shell: bash -# run: SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} -# - name: Upload outputs -# uses: actions/upload-artifact@v3 -# with: -# name: scan-outputs -# path: ${{ github.action_path }}/**/output/* + run: | + pip install scancodeio + SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe migrate + - name: Create project and run the ${{ inputs.pipeline-name }} pipeline + shell: bash + run: SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe create-project ${{ inputs.project-name }} + --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip + --pipeline ${{ inputs.pipeline-name }} + --execute + - name: Generate outputs + shell: bash + run: SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color + - name: Upload outputs + uses: actions/upload-artifact@v3 + with: + name: scan-outputs + path: ${{ github.action_path }}/**/output/* From 83df8072599dde0abf35028a8e3ac70afefe1b2f Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 13:38:09 -0700 Subject: [PATCH 16/80] Set the env var in an .env file Signed-off-by: tdruez --- action.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 9d092bc..788444e 100644 --- a/action.yml +++ b/action.yml @@ -25,18 +25,21 @@ runs: shell: bash run: | pip install scancodeio - SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe migrate + echo "SECRET_KEY=abcd" > .env + cat .env + echo ${{ github.action_path }} + SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe migrate - name: Create project and run the ${{ inputs.pipeline-name }} pipeline shell: bash - run: SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe create-project ${{ inputs.project-name }} + run: SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe create-project ${{ inputs.project-name }} --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip --pipeline ${{ inputs.pipeline-name }} --execute - name: Generate outputs shell: bash - run: SECRET_KEY="abc" SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color + run: SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color - name: Upload outputs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: scan-outputs path: ${{ github.action_path }}/**/output/* From e7d25c886d7b508e0a193c7223c2a1d890e8b7d5 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 13:41:35 -0700 Subject: [PATCH 17/80] Use proper .env location Signed-off-by: tdruez --- action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 788444e..b10a449 100644 --- a/action.yml +++ b/action.yml @@ -25,9 +25,8 @@ runs: shell: bash run: | pip install scancodeio - echo "SECRET_KEY=abcd" > .env - cat .env - echo ${{ github.action_path }} + echo "SECRET_KEY=abcd" > /etc/scancodeio/.env + cat /etc/scancodeio/.env SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe migrate - name: Create project and run the ${{ inputs.pipeline-name }} pipeline shell: bash From c4acc32def95406029fdfa56a4785fa4b40a1b64 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 13:43:22 -0700 Subject: [PATCH 18/80] debug Signed-off-by: tdruez --- action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/action.yml b/action.yml index b10a449..c9d231a 100644 --- a/action.yml +++ b/action.yml @@ -24,6 +24,8 @@ runs: - name: Install and setup ScanCode.io shell: bash run: | + touch /etc/scancodeio/.env + echo "SECRET_KEY=abcd" > /etc/scancodeio/.env pip install scancodeio echo "SECRET_KEY=abcd" > /etc/scancodeio/.env cat /etc/scancodeio/.env From 1b44d9129935b06134c62bf56e352066a70c3e91 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 13:44:59 -0700 Subject: [PATCH 19/80] debug Signed-off-by: tdruez --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index c9d231a..b7e18a3 100644 --- a/action.yml +++ b/action.yml @@ -24,9 +24,9 @@ runs: - name: Install and setup ScanCode.io shell: bash run: | - touch /etc/scancodeio/.env - echo "SECRET_KEY=abcd" > /etc/scancodeio/.env - pip install scancodeio + GET_SECRET_KEY=`cat /dev/urandom | head -c 50 | base64` + echo "SECRET_KEY=GET_SECRET_KEY" + # pip install scancodeio echo "SECRET_KEY=abcd" > /etc/scancodeio/.env cat /etc/scancodeio/.env SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe migrate From bb349ae2f72880a807868988536465c09e0fc462 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 13:53:18 -0700 Subject: [PATCH 20/80] debug Signed-off-by: tdruez --- action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/action.yml b/action.yml index b7e18a3..42a66bd 100644 --- a/action.yml +++ b/action.yml @@ -19,11 +19,13 @@ runs: using: "composite" steps: - uses: actions/setup-python@v5 + id: python with: python-version: ${{ inputs.python-version }} - name: Install and setup ScanCode.io shell: bash run: | + echo "${{ steps.python.outputs.python-path }}" GET_SECRET_KEY=`cat /dev/urandom | head -c 50 | base64` echo "SECRET_KEY=GET_SECRET_KEY" # pip install scancodeio From f4aba864e94952c3cf1bbd79031c13b29e8eaee5 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 13:54:03 -0700 Subject: [PATCH 21/80] debug Signed-off-by: tdruez --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 42a66bd..7a469a2 100644 --- a/action.yml +++ b/action.yml @@ -25,7 +25,7 @@ runs: - name: Install and setup ScanCode.io shell: bash run: | - echo "${{ steps.python.outputs.python-path }}" + ls -la ${{ steps.python.outputs.python-path }} GET_SECRET_KEY=`cat /dev/urandom | head -c 50 | base64` echo "SECRET_KEY=GET_SECRET_KEY" # pip install scancodeio From 25ab5553a4f85b282b84da7df3ff7c14cb7bfc03 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:00:41 -0700 Subject: [PATCH 22/80] debug Signed-off-by: tdruez --- action.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index 7a469a2..66ee016 100644 --- a/action.yml +++ b/action.yml @@ -17,6 +17,8 @@ inputs: default: "json xlsx spdx cyclonedx" runs: using: "composite" + env: + SECRET_KEY: aaaa steps: - uses: actions/setup-python@v5 id: python @@ -25,12 +27,10 @@ runs: - name: Install and setup ScanCode.io shell: bash run: | - ls -la ${{ steps.python.outputs.python-path }} - GET_SECRET_KEY=`cat /dev/urandom | head -c 50 | base64` - echo "SECRET_KEY=GET_SECRET_KEY" - # pip install scancodeio - echo "SECRET_KEY=abcd" > /etc/scancodeio/.env - cat /etc/scancodeio/.env + echo $SECRET_KEY + echo $RANDOM >> $SECRET_KEY + echo $SECRET_KEY + pip install scancodeio SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe migrate - name: Create project and run the ${{ inputs.pipeline-name }} pipeline shell: bash From c331b114734532921960dddc08df30eec566d5c4 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:01:56 -0700 Subject: [PATCH 23/80] debug Signed-off-by: tdruez --- action.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/action.yml b/action.yml index 66ee016..c72da71 100644 --- a/action.yml +++ b/action.yml @@ -17,8 +17,6 @@ inputs: default: "json xlsx spdx cyclonedx" runs: using: "composite" - env: - SECRET_KEY: aaaa steps: - uses: actions/setup-python@v5 id: python From 77b3010450c7c1878c41619a50111b41c6e67147 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:05:09 -0700 Subject: [PATCH 24/80] debug Signed-off-by: tdruez --- action.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index c72da71..59169df 100644 --- a/action.yml +++ b/action.yml @@ -19,14 +19,15 @@ runs: using: "composite" steps: - uses: actions/setup-python@v5 - id: python with: python-version: ${{ inputs.python-version }} + - name: Set up environment + shell: bash + run: | + echo "SECRET_KEY=abcd" >> $GITHUB_ENV - name: Install and setup ScanCode.io shell: bash run: | - echo $SECRET_KEY - echo $RANDOM >> $SECRET_KEY echo $SECRET_KEY pip install scancodeio SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe migrate From 78a32c505a573ed2f83d5cda7106addcd60e3f46 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:08:37 -0700 Subject: [PATCH 25/80] debug Signed-off-by: tdruez --- action.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index 59169df..174bcbb 100644 --- a/action.yml +++ b/action.yml @@ -24,22 +24,23 @@ runs: - name: Set up environment shell: bash run: | - echo "SECRET_KEY=abcd" >> $GITHUB_ENV - - name: Install and setup ScanCode.io + echo "SECRET_KEY=$(echo $RANDOM)" >> $GITHUB_ENV + echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV + echo SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV + - name: Install ScanCode.io shell: bash run: | - echo $SECRET_KEY pip install scancodeio - SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe migrate + scanpipe migrate - name: Create project and run the ${{ inputs.pipeline-name }} pipeline shell: bash - run: SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe create-project ${{ inputs.project-name }} + run: scanpipe create-project ${{ inputs.project-name }} --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip --pipeline ${{ inputs.pipeline-name }} --execute - name: Generate outputs shell: bash - run: SCANCODEIO_DB_ENGINE="django.db.backends.sqlite3" SCANCODEIO_DB_NAME="sqlite3.db" scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color + run: scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color - name: Upload outputs uses: actions/upload-artifact@v4 with: From 44c66e7a839d6a13cb23801ce7fce601f6106c45 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:10:26 -0700 Subject: [PATCH 26/80] debug Signed-off-by: tdruez --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 174bcbb..0764753 100644 --- a/action.yml +++ b/action.yml @@ -24,7 +24,7 @@ runs: - name: Set up environment shell: bash run: | - echo "SECRET_KEY=$(echo $RANDOM)" >> $GITHUB_ENV + echo "SECRET_KEY=ABCD" >> $GITHUB_ENV echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV echo SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV - name: Install ScanCode.io From 5a8c036052cef33607ade6c31e02f8b6e1ca18a7 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:12:45 -0700 Subject: [PATCH 27/80] debug Signed-off-by: tdruez --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 0764753..5844f45 100644 --- a/action.yml +++ b/action.yml @@ -26,7 +26,7 @@ runs: run: | echo "SECRET_KEY=ABCD" >> $GITHUB_ENV echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV - echo SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV + echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV - name: Install ScanCode.io shell: bash run: | From 07661a13814077ecc72eed37265915b7b7d52789 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:14:51 -0700 Subject: [PATCH 28/80] debug Signed-off-by: tdruez --- action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 5844f45..0714561 100644 --- a/action.yml +++ b/action.yml @@ -3,11 +3,9 @@ description: "Run ScanCode.io pipelines in your workflows" inputs: pipeline-name: description: "Name of the pipeline" - required: true default: "scan_codebase" project-name: description: "Name of the project" - required: true default: "scancode-action" python-version: description: "Python version" @@ -24,7 +22,7 @@ runs: - name: Set up environment shell: bash run: | - echo "SECRET_KEY=ABCD" >> $GITHUB_ENV + echo "SECRET_KEY=$(cat /dev/urandom | head -c 50 | base64)" >> $GITHUB_ENV echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV - name: Install ScanCode.io From ea87d6df19b7fdacd5f2cfcfce6d50d853bf60f4 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:24:35 -0700 Subject: [PATCH 29/80] debug Signed-off-by: tdruez --- action.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 0714561..0ee4636 100644 --- a/action.yml +++ b/action.yml @@ -22,7 +22,8 @@ runs: - name: Set up environment shell: bash run: | - echo "SECRET_KEY=$(cat /dev/urandom | head -c 50 | base64)" >> $GITHUB_ENV + echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV + echo $SECRET_KEY echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV - name: Install ScanCode.io @@ -38,9 +39,15 @@ runs: --execute - name: Generate outputs shell: bash - run: scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color + id: scanpipe + run: | + output=$(scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color) + echo "::set-output name=scanpipe-output-paths::$output" + - name: Use scanpipe output in the next step + run: echo "${{ steps.scanpipe.outputs.scanpipe-output-paths }}" - name: Upload outputs uses: actions/upload-artifact@v4 with: name: scan-outputs - path: ${{ github.action_path }}/**/output/* + path: ${{ steps.scanpipe.outputs.scanpipe-output-paths }} +# path: ${{ github.action_path }}/**/output/* From 32876e17928fb34c3fdf75370b30da08f6f902f1 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:27:44 -0700 Subject: [PATCH 30/80] debug Signed-off-by: tdruez --- action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 0ee4636..9e0c629 100644 --- a/action.yml +++ b/action.yml @@ -42,12 +42,11 @@ runs: id: scanpipe run: | output=$(scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color) - echo "::set-output name=scanpipe-output-paths::$output" + echo $output >> $GITHUB_OUTPUT - name: Use scanpipe output in the next step run: echo "${{ steps.scanpipe.outputs.scanpipe-output-paths }}" - name: Upload outputs uses: actions/upload-artifact@v4 with: name: scan-outputs - path: ${{ steps.scanpipe.outputs.scanpipe-output-paths }} -# path: ${{ github.action_path }}/**/output/* + path: ${{ outputs.scanpipe.value }} From 1baf3097744785f874d691acf4e2b36a061e38ed Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:30:47 -0700 Subject: [PATCH 31/80] debug Signed-off-by: tdruez --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 9e0c629..00ca0d5 100644 --- a/action.yml +++ b/action.yml @@ -38,13 +38,13 @@ runs: --pipeline ${{ inputs.pipeline-name }} --execute - name: Generate outputs - shell: bash id: scanpipe + shell: bash run: | output=$(scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color) - echo $output >> $GITHUB_OUTPUT + echo "output-paths=$output" >> $GITHUB_OUTPUT - name: Use scanpipe output in the next step - run: echo "${{ steps.scanpipe.outputs.scanpipe-output-paths }}" + run: echo "${{ steps.scanpipe.outputs.output-paths }}" - name: Upload outputs uses: actions/upload-artifact@v4 with: From 844ba51e9018ee7a456e23cf1248dfbc1f8c1599 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:33:31 -0700 Subject: [PATCH 32/80] debug Signed-off-by: tdruez --- action.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 00ca0d5..34fc148 100644 --- a/action.yml +++ b/action.yml @@ -44,9 +44,10 @@ runs: output=$(scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color) echo "output-paths=$output" >> $GITHUB_OUTPUT - name: Use scanpipe output in the next step + shell: bash run: echo "${{ steps.scanpipe.outputs.output-paths }}" - - name: Upload outputs - uses: actions/upload-artifact@v4 - with: - name: scan-outputs - path: ${{ outputs.scanpipe.value }} +# - name: Upload outputs +# uses: actions/upload-artifact@v4 +# with: +# name: scan-outputs +# path: ${{ outputs.scanpipe.value }} From 896e0435350eb2eca18221e4310c3b05544006e2 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:36:59 -0700 Subject: [PATCH 33/80] debug Signed-off-by: tdruez --- action.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 34fc148..3fbfe1d 100644 --- a/action.yml +++ b/action.yml @@ -13,6 +13,9 @@ inputs: output-formats: description: "Output formats" default: "json xlsx spdx cyclonedx" +outputs: + output-paths: + description: "Paths of the output files." runs: using: "composite" steps: @@ -45,7 +48,7 @@ runs: echo "output-paths=$output" >> $GITHUB_OUTPUT - name: Use scanpipe output in the next step shell: bash - run: echo "${{ steps.scanpipe.outputs.output-paths }}" + run: echo "${{ outputs.output-paths }}" # - name: Upload outputs # uses: actions/upload-artifact@v4 # with: From 9c062625b1e75eadf85ecbb285d5f1d750f413a2 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:40:44 -0700 Subject: [PATCH 34/80] debug Signed-off-by: tdruez --- action.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/action.yml b/action.yml index 3fbfe1d..27a0a9f 100644 --- a/action.yml +++ b/action.yml @@ -13,9 +13,9 @@ inputs: output-formats: description: "Output formats" default: "json xlsx spdx cyclonedx" -outputs: - output-paths: - description: "Paths of the output files." +#outputs: +# output-paths: +# description: "Paths of the output files." runs: using: "composite" steps: @@ -48,9 +48,9 @@ runs: echo "output-paths=$output" >> $GITHUB_OUTPUT - name: Use scanpipe output in the next step shell: bash - run: echo "${{ outputs.output-paths }}" -# - name: Upload outputs -# uses: actions/upload-artifact@v4 -# with: -# name: scan-outputs -# path: ${{ outputs.scanpipe.value }} + run: echo "${{ steps.scanpipe.outputs.output-paths }}" + - name: Upload outputs + uses: actions/upload-artifact@v4 + with: + name: scan-outputs + path: ${{ steps.scanpipe.outputs.output-paths }} From eadf78f8c77600091cd075fec5ce0d13d346d408 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:43:32 -0700 Subject: [PATCH 35/80] debug Signed-off-by: tdruez --- action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 27a0a9f..0070721 100644 --- a/action.yml +++ b/action.yml @@ -12,7 +12,8 @@ inputs: default: "3.11" output-formats: description: "Output formats" - default: "json xlsx spdx cyclonedx" +# default: "json xlsx spdx cyclonedx" + default: "json" #outputs: # output-paths: # description: "Paths of the output files." From 137846d41e5588ce32157dad6f84fd95bae16b72 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:48:18 -0700 Subject: [PATCH 36/80] debug Signed-off-by: tdruez --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 0070721..1252afc 100644 --- a/action.yml +++ b/action.yml @@ -46,7 +46,7 @@ runs: shell: bash run: | output=$(scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color) - echo "output-paths=$output" >> $GITHUB_OUTPUT + echo "output-paths=\"$output\"" >> $GITHUB_OUTPUT - name: Use scanpipe output in the next step shell: bash run: echo "${{ steps.scanpipe.outputs.output-paths }}" From d0c686d6917d571cfd148d3fbde42edbfa45163c Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:53:08 -0700 Subject: [PATCH 37/80] debug Signed-off-by: tdruez --- action.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index 1252afc..8b9999e 100644 --- a/action.yml +++ b/action.yml @@ -45,13 +45,12 @@ runs: id: scanpipe shell: bash run: | - output=$(scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color) - echo "output-paths=\"$output\"" >> $GITHUB_OUTPUT - - name: Use scanpipe output in the next step - shell: bash - run: echo "${{ steps.scanpipe.outputs.output-paths }}" + scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color + work_directory=$(./manage.py status --project ${{ inputs.project-name }} | grep -oP 'Work directory:\s*\K[^\n]+') + echo "Work directory path: $work_directory" + echo "work-directory=$work_directory" >> $GITHUB_OUTPUT - name: Upload outputs uses: actions/upload-artifact@v4 with: name: scan-outputs - path: ${{ steps.scanpipe.outputs.output-paths }} + path: ${{ steps.scanpipe.outputs.work-directory }} From f7db597848ac8d1711ae640b62862f3d3ec809f1 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:55:08 -0700 Subject: [PATCH 38/80] debug Signed-off-by: tdruez --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 8b9999e..e488653 100644 --- a/action.yml +++ b/action.yml @@ -46,11 +46,11 @@ runs: shell: bash run: | scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color - work_directory=$(./manage.py status --project ${{ inputs.project-name }} | grep -oP 'Work directory:\s*\K[^\n]+') + work_directory=$(scanpipe status --project ${{ inputs.project-name }} | grep -oP 'Work directory:\s*\K[^\n]+') echo "Work directory path: $work_directory" echo "work-directory=$work_directory" >> $GITHUB_OUTPUT - name: Upload outputs uses: actions/upload-artifact@v4 with: name: scan-outputs - path: ${{ steps.scanpipe.outputs.work-directory }} + path: ${{ steps.scanpipe.outputs.work-directory }}/output From d8b1423764d6b4def65090a1eac9988c8a5886c5 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 14:57:46 -0700 Subject: [PATCH 39/80] debug Signed-off-by: tdruez --- action.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index e488653..7efa887 100644 --- a/action.yml +++ b/action.yml @@ -12,8 +12,7 @@ inputs: default: "3.11" output-formats: description: "Output formats" -# default: "json xlsx spdx cyclonedx" - default: "json" + default: "json xlsx spdx cyclonedx" #outputs: # output-paths: # description: "Paths of the output files." @@ -52,5 +51,5 @@ runs: - name: Upload outputs uses: actions/upload-artifact@v4 with: - name: scan-outputs - path: ${{ steps.scanpipe.outputs.work-directory }}/output + name: scanpipe-outputs + path: ${{ steps.scanpipe.outputs.work-directory }}/output/* From e088d3174906a43859d9a6f724657be934fd8c64 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 15:05:27 -0700 Subject: [PATCH 40/80] debug Signed-off-by: tdruez --- action.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 7efa887..4167ce2 100644 --- a/action.yml +++ b/action.yml @@ -16,40 +16,49 @@ inputs: #outputs: # output-paths: # description: "Paths of the output files." + runs: using: "composite" steps: - uses: actions/setup-python@v5 with: python-version: ${{ inputs.python-version }} + - name: Set up environment shell: bash run: | echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV - echo $SECRET_KEY + echo ${{ env.SECRET_KEY }} echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV + - name: Install ScanCode.io shell: bash run: | pip install scancodeio scanpipe migrate + - name: Create project and run the ${{ inputs.pipeline-name }} pipeline shell: bash run: scanpipe create-project ${{ inputs.project-name }} --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip --pipeline ${{ inputs.pipeline-name }} --execute + + - name: Set project work directory path in the environment + shell: bash + run: | + work_directory=$(scanpipe status --project ${{ inputs.project-name }} | grep -oP 'Work directory:\s*\K[^\n]+') + echo "WORK_DIRECTORY=$work_directory" >> $GITHUB_ENV + - name: Generate outputs id: scanpipe shell: bash run: | scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color - work_directory=$(scanpipe status --project ${{ inputs.project-name }} | grep -oP 'Work directory:\s*\K[^\n]+') - echo "Work directory path: $work_directory" - echo "work-directory=$work_directory" >> $GITHUB_OUTPUT + - name: Upload outputs uses: actions/upload-artifact@v4 with: name: scanpipe-outputs - path: ${{ steps.scanpipe.outputs.work-directory }}/output/* + path: ${{ env.WORK_DIRECTORY }}/output/* From 111daffc4ab5995e9622e8916b0396bc8051b949 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 15:08:08 -0700 Subject: [PATCH 41/80] debug Signed-off-by: tdruez --- action.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 4167ce2..9e4745e 100644 --- a/action.yml +++ b/action.yml @@ -28,7 +28,9 @@ runs: shell: bash run: | echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV - echo ${{ env.SECRET_KEY }} + echo "${{ env.SECRET_KEY }}" + echo "$(openssl rand -base64 32)" + echo "$(echo $RANDOM)" echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV @@ -59,6 +61,10 @@ runs: - name: Upload outputs uses: actions/upload-artifact@v4 + id: artifact-upload-step with: name: scanpipe-outputs path: ${{ env.WORK_DIRECTORY }}/output/* + + - name: Output artifact ID + run: echo 'Artifact URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}' From 334f1c879a9be4763b15855f7b0ecc62cd403f99 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 15:09:03 -0700 Subject: [PATCH 42/80] debug Signed-off-by: tdruez --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 9e4745e..7ae37f1 100644 --- a/action.yml +++ b/action.yml @@ -67,4 +67,5 @@ runs: path: ${{ env.WORK_DIRECTORY }}/output/* - name: Output artifact ID + shell: bash run: echo 'Artifact URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}' From 29e4d825ea264a61e07d3bd9ff8a018deb1e4825 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 15:11:31 -0700 Subject: [PATCH 43/80] debug Signed-off-by: tdruez --- action.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 7ae37f1..093e35d 100644 --- a/action.yml +++ b/action.yml @@ -28,9 +28,6 @@ runs: shell: bash run: | echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV - echo "${{ env.SECRET_KEY }}" - echo "$(openssl rand -base64 32)" - echo "$(echo $RANDOM)" echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV @@ -49,15 +46,15 @@ runs: - name: Set project work directory path in the environment shell: bash - run: | - work_directory=$(scanpipe status --project ${{ inputs.project-name }} | grep -oP 'Work directory:\s*\K[^\n]+') + run: | + project_status=$(./manage.py status --project ${{ inputs.project-name }}) + work_directory=$(echo "$project_status" | grep -oP 'Work directory:\s*\K[^\n]+') echo "WORK_DIRECTORY=$work_directory" >> $GITHUB_ENV - name: Generate outputs id: scanpipe shell: bash - run: | - scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color + run: scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color - name: Upload outputs uses: actions/upload-artifact@v4 From d76407bc758733d4094ce5bc00c6493975a1e104 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 15:13:25 -0700 Subject: [PATCH 44/80] debug Signed-off-by: tdruez --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 093e35d..1654d6b 100644 --- a/action.yml +++ b/action.yml @@ -47,7 +47,7 @@ runs: - name: Set project work directory path in the environment shell: bash run: | - project_status=$(./manage.py status --project ${{ inputs.project-name }}) + project_status=$(scanpipe status --project ${{ inputs.project-name }}) work_directory=$(echo "$project_status" | grep -oP 'Work directory:\s*\K[^\n]+') echo "WORK_DIRECTORY=$work_directory" >> $GITHUB_ENV @@ -63,6 +63,6 @@ runs: name: scanpipe-outputs path: ${{ env.WORK_DIRECTORY }}/output/* - - name: Output artifact ID + - name: Artifact download URL shell: bash - run: echo 'Artifact URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}' + run: echo "Artifact can be downloaded from ${{ steps.artifact-upload-step.outputs.artifact-url }}" From e8f6cd1ac94b115daf6e86e8a8db95eea61ef414 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 15:15:43 -0700 Subject: [PATCH 45/80] debug Signed-off-by: tdruez --- action.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/action.yml b/action.yml index 1654d6b..9a185b0 100644 --- a/action.yml +++ b/action.yml @@ -62,7 +62,3 @@ runs: with: name: scanpipe-outputs path: ${{ env.WORK_DIRECTORY }}/output/* - - - name: Artifact download URL - shell: bash - run: echo "Artifact can be downloaded from ${{ steps.artifact-upload-step.outputs.artifact-url }}" From eb01d321573ea91e37539502bfa45cf51b97cac8 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 16:00:18 -0700 Subject: [PATCH 46/80] cleanup Signed-off-by: tdruez --- action.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/action.yml b/action.yml index 9a185b0..8179b62 100644 --- a/action.yml +++ b/action.yml @@ -13,9 +13,6 @@ inputs: output-formats: description: "Output formats" default: "json xlsx spdx cyclonedx" -#outputs: -# output-paths: -# description: "Paths of the output files." runs: using: "composite" From 46395124cdd90df4c351f440932b72d5e6814fd9 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 16:02:04 -0700 Subject: [PATCH 47/80] cleanup Signed-off-by: tdruez --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 04522b0..a3277a3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,10 +1,10 @@ on: [push] jobs: - scan: + scan-codebase: runs-on: ubuntu-latest - name: ScanCode-action + name: Scan codebase with ScanCode.io steps: - uses: nexB/scancode-action@alpha with: - output-formats: "json xlsx spdx cyclonedx" + pipeline-name: "scan_codebase" From 20d08af9be9556a1ddfe095db0d7aa1ac00d3108 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 16:26:09 -0700 Subject: [PATCH 48/80] Add README Signed-off-by: tdruez --- README.md | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- action.yml | 6 ++-- 2 files changed, 82 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7ac3662..7c62055 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,79 @@ -# scancode-action -Run ScanCode scan in your workflow +# `@nexB/scancode-action` + +Run [ScanCode.io](https://github.com/nexB/scancode.io) on your repo from your Workflows. + +- [Usage](#usage) + - [Inputs](#inputs) +- [Examples](#examples) + - [Scan repo codebase](#scan-repo-codebase) + - [Use a specific pipeline](#use-a-specific-pipeline) + - [Choose the output formats](#choose-the-output-formats) + - [Define a custom project name](#define-a-custom-project-name) +- [Where does the scan results go?](#where-does-the-scan-results-go) + +> [!IMPORTANT] +> The scancode-action is currently in the alpha stage, and we invite you to contribute to its improvement. Please feel free to submit bug reports or share your ideas by creating new entries in the "Issues" section. Your collaboration helps us enhance the action and ensures a more stable and effective tool for the community. Thank you for your support! + +## Usage + +### Inputs + +```yaml +- uses: nexB/scancode-action@alpha + with: + # Name of the pipeline. + # Default is 'scan_codebase' + pipeline-name: + + # The list of output formats to generate. + # Default is 'json xlsx spdx cyclonedx' + output-formats: + + # Name of the project. + # Default is 'scancode-action' + project-name: + + # Python version that will be installed to run ScanCode.io + # Default is '3.11' + python-version: +``` + +## Examples + +### Scan repo codebase + +```yaml +steps: +- uses: nexB/scancode-action@alpha +``` + +### Use a specific pipeline + +```yaml +- uses: nexB/scancode-action@alpha + with: + pipeline-name: "scan_codebase" +``` + +### Choose the output formats + +```yaml +- uses: nexB/scancode-action@alpha + with: + output-formats: "json xlsx spdx cyclonedx" +``` + +### Define a custom project name + +```yaml +- uses: nexB/scancode-action@alpha + with: + project-name: "my-project-name" +``` + +## Where are the Scan Results? + +Upon completion of the workflow, you can find the scan results in the dedicated +artifacts section at the bottom of the workflow summary page. +Look for a file named `scanpipe-outputs` in that section. +This file contains the outputs generated by the `scancode-action`. diff --git a/action.yml b/action.yml index 8179b62..8966aa1 100644 --- a/action.yml +++ b/action.yml @@ -4,15 +4,15 @@ inputs: pipeline-name: description: "Name of the pipeline" default: "scan_codebase" + output-formats: + description: "Output formats" + default: "json xlsx spdx cyclonedx" project-name: description: "Name of the project" default: "scancode-action" python-version: description: "Python version" default: "3.11" - output-formats: - description: "Output formats" - default: "json xlsx spdx cyclonedx" runs: using: "composite" From 2f2097d164fe327c165dbda83a845919db6ee4b9 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 16:31:51 -0700 Subject: [PATCH 49/80] Improve README Signed-off-by: tdruez --- README.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7c62055..718fb29 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,16 @@ Run [ScanCode.io](https://github.com/nexB/scancode.io) on your repo from your Workflows. +> [!IMPORTANT] +> The scancode-action is currently in the **alpha stage**, and we invite you to +> contribute to its improvement. Please feel free to submit bug reports or share +> your ideas by creating new entries in the "Issues" section. +> Your collaboration helps us enhance the action and ensures a more stable and +> effective tool for the community. +> Thank you for your support! + - [Usage](#usage) + - [Basic](#basic) - [Inputs](#inputs) - [Examples](#examples) - [Scan repo codebase](#scan-repo-codebase) @@ -11,11 +20,19 @@ Run [ScanCode.io](https://github.com/nexB/scancode.io) on your repo from your Wo - [Define a custom project name](#define-a-custom-project-name) - [Where does the scan results go?](#where-does-the-scan-results-go) -> [!IMPORTANT] -> The scancode-action is currently in the alpha stage, and we invite you to contribute to its improvement. Please feel free to submit bug reports or share your ideas by creating new entries in the "Issues" section. Your collaboration helps us enhance the action and ensures a more stable and effective tool for the community. Thank you for your support! - ## Usage +### Basic + +```yaml +steps: +- uses: actions/checkout@v4 +- uses: nexB/scancode-action@alpha + with: + pipeline-name: "scan_codebase" + output-formats: "json xlsx spdx cyclonedx" +``` + ### Inputs ```yaml @@ -73,7 +90,7 @@ steps: ## Where are the Scan Results? -Upon completion of the workflow, you can find the scan results in the dedicated -artifacts section at the bottom of the workflow summary page. +Upon completion of the workflow, you can **find the scan results** in the dedicated +**artifacts section** at the bottom of the workflow summary page. Look for a file named `scanpipe-outputs` in that section. This file contains the outputs generated by the `scancode-action`. From d9695ecac833a8de42a2731420f19e0cc71ef885 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 18:43:17 -0700 Subject: [PATCH 50/80] Use ${GITHUB_REPOSITORY} as default project name Signed-off-by: tdruez --- README.md | 4 ++-- action.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 718fb29..ae961b3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # `@nexB/scancode-action` -Run [ScanCode.io](https://github.com/nexB/scancode.io) on your repo from your Workflows. +Run [ScanCode.io](https://github.com/nexB/scancode.io) pipelines from your Workflows. > [!IMPORTANT] > The scancode-action is currently in the **alpha stage**, and we invite you to @@ -47,7 +47,7 @@ steps: output-formats: # Name of the project. - # Default is 'scancode-action' + # Default is ${GITHUB_REPOSITORY} project-name: # Python version that will be installed to run ScanCode.io diff --git a/action.yml b/action.yml index 8966aa1..4fe6e12 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,7 @@ inputs: default: "json xlsx spdx cyclonedx" project-name: description: "Name of the project" - default: "scancode-action" + default: ${GITHUB_REPOSITORY} python-version: description: "Python version" default: "3.11" From f4df89462b7a3279c217046503f073076b28482d Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 18:52:16 -0700 Subject: [PATCH 51/80] Set default project name Signed-off-by: tdruez --- README.md | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ae961b3..1e218f0 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ steps: output-formats: # Name of the project. - # Default is ${GITHUB_REPOSITORY} + # Default is 'scancode-action' project-name: # Python version that will be installed to run ScanCode.io diff --git a/action.yml b/action.yml index 4fe6e12..c3e6942 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,7 @@ inputs: default: "json xlsx spdx cyclonedx" project-name: description: "Name of the project" - default: ${GITHUB_REPOSITORY} + default: "${{ github.event.repository.name || 'scancode-action' }}" python-version: description: "Python version" default: "3.11" From d23a862704d18a644b3284be3af01a4aff20c27e Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 18:56:15 -0700 Subject: [PATCH 52/80] Set default project name Signed-off-by: tdruez --- README.md | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1e218f0..4b77e66 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ steps: output-formats: # Name of the project. - # Default is 'scancode-action' + # Default is $GITHUB_REPOSITORY project-name: # Python version that will be installed to run ScanCode.io diff --git a/action.yml b/action.yml index c3e6942..cc5a5a9 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,7 @@ inputs: default: "json xlsx spdx cyclonedx" project-name: description: "Name of the project" - default: "${{ github.event.repository.name || 'scancode-action' }}" + default: ${{ GITHUB_REPOSITORY | sed 's/\//_/g' }} python-version: description: "Python version" default: "3.11" From db3de662ed275881bb2636fb680ffdd91d5e1fa9 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 18:57:17 -0700 Subject: [PATCH 53/80] Set default project name Signed-off-by: tdruez --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index cc5a5a9..87c8a88 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,7 @@ inputs: default: "json xlsx spdx cyclonedx" project-name: description: "Name of the project" - default: ${{ GITHUB_REPOSITORY | sed 's/\//_/g' }} + default: ${{ ${GITHUB_REPOSITORY} | sed 's/\//_/g' }} python-version: description: "Python version" default: "3.11" From 6c490c2ac267dcf7160f4651fc93af2363dbf5a4 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 18:58:36 -0700 Subject: [PATCH 54/80] Set default project name Signed-off-by: tdruez --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 87c8a88..968b524 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,7 @@ inputs: default: "json xlsx spdx cyclonedx" project-name: description: "Name of the project" - default: ${{ ${GITHUB_REPOSITORY} | sed 's/\//_/g' }} + default: "${{ env.GITHUB_REPOSITORY//\//_ }}" python-version: description: "Python version" default: "3.11" From 0b5d2fce80afb7f0ffacf627e49ddfd16e1988a1 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 18:59:22 -0700 Subject: [PATCH 55/80] Revert changes Signed-off-by: tdruez --- README.md | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4b77e66..1e218f0 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ steps: output-formats: # Name of the project. - # Default is $GITHUB_REPOSITORY + # Default is 'scancode-action' project-name: # Python version that will be installed to run ScanCode.io diff --git a/action.yml b/action.yml index 968b524..8966aa1 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,7 @@ inputs: default: "json xlsx spdx cyclonedx" project-name: description: "Name of the project" - default: "${{ env.GITHUB_REPOSITORY//\//_ }}" + default: "scancode-action" python-version: description: "Python version" default: "3.11" From 40d424074a0f9555d472ba28f3709fc3ca95722a Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 19:14:53 -0700 Subject: [PATCH 56/80] Support for multiple pipelines Signed-off-by: tdruez --- .github/workflows/main.yml | 2 +- README.md | 6 +++--- action.yml | 18 ++++++++++++++---- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a3277a3..d357a2a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,4 +7,4 @@ jobs: steps: - uses: nexB/scancode-action@alpha with: - pipeline-name: "scan_codebase" + pipelines: "scan_codebase" diff --git a/README.md b/README.md index 1e218f0..b3b65e2 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ steps: - uses: actions/checkout@v4 - uses: nexB/scancode-action@alpha with: - pipeline-name: "scan_codebase" + pipelines: "scan_codebase" output-formats: "json xlsx spdx cyclonedx" ``` @@ -40,7 +40,7 @@ steps: with: # Name of the pipeline. # Default is 'scan_codebase' - pipeline-name: + pipelines: # The list of output formats to generate. # Default is 'json xlsx spdx cyclonedx' @@ -69,7 +69,7 @@ steps: ```yaml - uses: nexB/scancode-action@alpha with: - pipeline-name: "scan_codebase" + pipelines: "scan_codebase" ``` ### Choose the output formats diff --git a/action.yml b/action.yml index 8966aa1..0ebd3b8 100644 --- a/action.yml +++ b/action.yml @@ -1,8 +1,8 @@ name: "ScanCode action" description: "Run ScanCode.io pipelines in your workflows" inputs: - pipeline-name: - description: "Name of the pipeline" + pipelines: + description: "Names of the pipelines (comma-separated)" default: "scan_codebase" output-formats: description: "Output formats" @@ -34,11 +34,21 @@ runs: pip install scancodeio scanpipe migrate - - name: Create project and run the ${{ inputs.pipeline-name }} pipeline + - name: Generate pipelines CLI arguments + shell: bash + run: | + IFS=',' read -ra PIPELINES <<< "${{ inputs.pipeline-names }}" + options="" + for pipeline in "${PIPELINES[@]}"; do + options+="--pipeline $pipeline " + done + echo "PIPELINE_CLI_ARGS=$options" >> $GITHUB_ENV + + - name: Create project and run the ${{ inputs.pipelines }} pipelines shell: bash run: scanpipe create-project ${{ inputs.project-name }} --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip - --pipeline ${{ inputs.pipeline-name }} + ${{ env.PIPELINE_CLI_ARGS }} --execute - name: Set project work directory path in the environment From e16ce936e9247e8c63d6749a9f8548e5166bf72b Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 19:18:06 -0700 Subject: [PATCH 57/80] Support for multiple pipelines Signed-off-by: tdruez --- .github/workflows/main.yml | 2 +- action.yml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d357a2a..fcb708a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,4 +7,4 @@ jobs: steps: - uses: nexB/scancode-action@alpha with: - pipelines: "scan_codebase" + pipelines: "scan_codebase,find_vulnerabilities" diff --git a/action.yml b/action.yml index 0ebd3b8..9e2e2d4 100644 --- a/action.yml +++ b/action.yml @@ -37,12 +37,13 @@ runs: - name: Generate pipelines CLI arguments shell: bash run: | - IFS=',' read -ra PIPELINES <<< "${{ inputs.pipeline-names }}" + IFS=',' read -ra PIPELINES <<< "${{ inputs.pipelines }}" options="" for pipeline in "${PIPELINES[@]}"; do + echo "loop" options+="--pipeline $pipeline " done - echo "PIPELINE_CLI_ARGS=$options" >> $GITHUB_ENV + echo "PIPELINE_CLI_ARGS=$pipeline" >> $GITHUB_ENV - name: Create project and run the ${{ inputs.pipelines }} pipelines shell: bash From 43773d63e1307811e2fbea79bca0df117a22ca08 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 19:21:27 -0700 Subject: [PATCH 58/80] Support for multiple pipelines Signed-off-by: tdruez --- action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 9e2e2d4..c679f2c 100644 --- a/action.yml +++ b/action.yml @@ -40,10 +40,9 @@ runs: IFS=',' read -ra PIPELINES <<< "${{ inputs.pipelines }}" options="" for pipeline in "${PIPELINES[@]}"; do - echo "loop" options+="--pipeline $pipeline " done - echo "PIPELINE_CLI_ARGS=$pipeline" >> $GITHUB_ENV + echo "PIPELINE_CLI_ARGS=${options}" >> $GITHUB_ENV - name: Create project and run the ${{ inputs.pipelines }} pipelines shell: bash From 5ad2862f08e181700b5bbac3c83880c70be38e71 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 19:25:52 -0700 Subject: [PATCH 59/80] Support for multiple pipelines Signed-off-by: tdruez --- action.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index c679f2c..1b6afa1 100644 --- a/action.yml +++ b/action.yml @@ -46,10 +46,13 @@ runs: - name: Create project and run the ${{ inputs.pipelines }} pipelines shell: bash - run: scanpipe create-project ${{ inputs.project-name }} - --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip - ${{ env.PIPELINE_CLI_ARGS }} - --execute + run: | + set -e + scanpipe create-project ${{ inputs.project-name }} \ + --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip \ + ${{ env.PIPELINE_CLI_ARGS }} \ + --execute + set +e - name: Set project work directory path in the environment shell: bash From d76366214b82a2c413cc13407c53d81a2ab6bfec Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 19:29:41 -0700 Subject: [PATCH 60/80] Improve docs Signed-off-by: tdruez --- README.md | 15 ++++++++++++--- action.yml | 4 +--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b3b65e2..51ae058 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ Run [ScanCode.io](https://github.com/nexB/scancode.io) pipelines from your Workf - [Inputs](#inputs) - [Examples](#examples) - [Scan repo codebase](#scan-repo-codebase) - - [Use a specific pipeline](#use-a-specific-pipeline) + - [Run a specific pipeline](#run-a-specific-pipeline) + - [Run multiple pipelines](#run-multiple-pipelines) - [Choose the output formats](#choose-the-output-formats) - [Define a custom project name](#define-a-custom-project-name) - [Where does the scan results go?](#where-does-the-scan-results-go) @@ -38,7 +39,7 @@ steps: ```yaml - uses: nexB/scancode-action@alpha with: - # Name of the pipeline. + # Names of the pipelines (comma-separated) and in order. # Default is 'scan_codebase' pipelines: @@ -64,7 +65,7 @@ steps: - uses: nexB/scancode-action@alpha ``` -### Use a specific pipeline +### Run a specific pipeline ```yaml - uses: nexB/scancode-action@alpha @@ -72,6 +73,14 @@ steps: pipelines: "scan_codebase" ``` +### Run multiple pipelines + +```yaml +- uses: nexB/scancode-action@alpha + with: + pipelines: "scan_codebase,find_vulnerabilities" +``` + ### Choose the output formats ```yaml diff --git a/action.yml b/action.yml index 1b6afa1..611da7f 100644 --- a/action.yml +++ b/action.yml @@ -2,7 +2,7 @@ name: "ScanCode action" description: "Run ScanCode.io pipelines in your workflows" inputs: pipelines: - description: "Names of the pipelines (comma-separated)" + description: "Names of the pipelines (comma-separated) and in order." default: "scan_codebase" output-formats: description: "Output formats" @@ -47,12 +47,10 @@ runs: - name: Create project and run the ${{ inputs.pipelines }} pipelines shell: bash run: | - set -e scanpipe create-project ${{ inputs.project-name }} \ --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip \ ${{ env.PIPELINE_CLI_ARGS }} \ --execute - set +e - name: Set project work directory path in the environment shell: bash From e4a81e9aa56d156bffbd25e94ccfa9ba71b546df Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 19:35:16 -0700 Subject: [PATCH 61/80] Replace download by checkout action Signed-off-by: tdruez --- .github/workflows/main.yml | 1 + README.md | 1 + action.yml | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fcb708a..86a6da5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,6 +5,7 @@ jobs: runs-on: ubuntu-latest name: Scan codebase with ScanCode.io steps: + - uses: actions/checkout@v4 - uses: nexB/scancode-action@alpha with: pipelines: "scan_codebase,find_vulnerabilities" diff --git a/README.md b/README.md index 51ae058..3d4f021 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ steps: ```yaml steps: +- uses: actions/checkout@v4 - uses: nexB/scancode-action@alpha ``` diff --git a/action.yml b/action.yml index 611da7f..d94dd62 100644 --- a/action.yml +++ b/action.yml @@ -47,8 +47,11 @@ runs: - name: Create project and run the ${{ inputs.pipelines }} pipelines shell: bash run: | + echo $GITHUB_WORKSPACE + ls -la $GITHUB_WORKSPACE scanpipe create-project ${{ inputs.project-name }} \ - --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip \ +# --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip \ + --copy-codebase $GITHUB_WORKSPACE \ ${{ env.PIPELINE_CLI_ARGS }} \ --execute From fdd28268157b56bf5e135a0e28c15e38ab4d83f4 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 29 Jan 2024 19:35:50 -0700 Subject: [PATCH 62/80] Replace download by checkout action Signed-off-by: tdruez --- action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/action.yml b/action.yml index d94dd62..317b93f 100644 --- a/action.yml +++ b/action.yml @@ -50,7 +50,6 @@ runs: echo $GITHUB_WORKSPACE ls -la $GITHUB_WORKSPACE scanpipe create-project ${{ inputs.project-name }} \ -# --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip \ --copy-codebase $GITHUB_WORKSPACE \ ${{ env.PIPELINE_CLI_ARGS }} \ --execute From 22e6811d7c1af74c862c5546bc4d7550f36c0d2a Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 09:02:19 -0700 Subject: [PATCH 63/80] env Signed-off-by: tdruez --- .github/workflows/main.yml | 2 ++ action.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 86a6da5..0b537f4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,3 +9,5 @@ jobs: - uses: nexB/scancode-action@alpha with: pipelines: "scan_codebase,find_vulnerabilities" + env: + VULNERABLECODE_URL: https://public.vulnerablecode.io/ diff --git a/action.yml b/action.yml index 317b93f..2aca0b4 100644 --- a/action.yml +++ b/action.yml @@ -27,6 +27,8 @@ runs: echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV + echo $VULNERABLECODE_URL + echo ${{ env.$VULNERABLECODE_URL }} - name: Install ScanCode.io shell: bash From c6f27b7581f0f02a324ddf84d7e40a974a4d629a Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 09:02:57 -0700 Subject: [PATCH 64/80] env Signed-off-by: tdruez --- action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/action.yml b/action.yml index 2aca0b4..9191224 100644 --- a/action.yml +++ b/action.yml @@ -27,7 +27,6 @@ runs: echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV - echo $VULNERABLECODE_URL echo ${{ env.$VULNERABLECODE_URL }} - name: Install ScanCode.io From 934afbdd965b24246ad089ecfd7daec06f36610e Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 09:03:50 -0700 Subject: [PATCH 65/80] env Signed-off-by: tdruez --- action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 9191224..1e3bb82 100644 --- a/action.yml +++ b/action.yml @@ -27,7 +27,8 @@ runs: echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV - echo ${{ env.$VULNERABLECODE_URL }} + echo $VULNERABLECODE_URL + echo ${{ env.VULNERABLECODE_URL }} - name: Install ScanCode.io shell: bash From 0fa92116734393e505b66d082090c59ccb23fae0 Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 09:10:41 -0700 Subject: [PATCH 66/80] env Signed-off-by: tdruez --- README.md | 2 ++ action.yml | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3d4f021..1a432f0 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,8 @@ steps: ### Run a specific pipeline +[Built-in pipelines list](https://scancodeio.readthedocs.io/en/latest/built-in-pipelines.html) + ```yaml - uses: nexB/scancode-action@alpha with: diff --git a/action.yml b/action.yml index 1e3bb82..bdad9d0 100644 --- a/action.yml +++ b/action.yml @@ -27,7 +27,6 @@ runs: echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV - echo $VULNERABLECODE_URL echo ${{ env.VULNERABLECODE_URL }} - name: Install ScanCode.io @@ -52,7 +51,7 @@ runs: echo $GITHUB_WORKSPACE ls -la $GITHUB_WORKSPACE scanpipe create-project ${{ inputs.project-name }} \ - --copy-codebase $GITHUB_WORKSPACE \ + --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip \ ${{ env.PIPELINE_CLI_ARGS }} \ --execute @@ -61,16 +60,19 @@ runs: run: | project_status=$(scanpipe status --project ${{ inputs.project-name }}) work_directory=$(echo "$project_status" | grep -oP 'Work directory:\s*\K[^\n]+') - echo "WORK_DIRECTORY=$work_directory" >> $GITHUB_ENV + echo "PROJECT_WORK_DIRECTORY=$work_directory" >> $GITHUB_ENV - name: Generate outputs id: scanpipe shell: bash - run: scanpipe output --project ${{ inputs.project-name }} --format ${{ inputs.output-formats }} --no-color + run: scanpipe output + --project ${{ inputs.project-name }} + --format ${{ inputs.output-formats }} + --no-color - name: Upload outputs uses: actions/upload-artifact@v4 id: artifact-upload-step with: name: scanpipe-outputs - path: ${{ env.WORK_DIRECTORY }}/output/* + path: ${{ env.PROJECT_WORK_DIRECTORY }}/output/* From 7145b191a04de0eb63776b0ae1063f9aae38a892 Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 09:24:22 -0700 Subject: [PATCH 67/80] docs Signed-off-by: tdruez --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 1a432f0..385671d 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,20 @@ steps: - uses: nexB/scancode-action@alpha with: pipelines: "scan_codebase,find_vulnerabilities" + env: + VULNERABLECODE_URL: https://public.vulnerablecode.io/ ``` +#### Configuring `find_vulnerabilities` Pipeline + +The `find_vulnerabilities` pipeline requires access to a VulnerableCode instance, +which can be defined using the `VULNERABLECODE_URL` environment variable. + +In the example provided, a public instance is referenced. +However, you also have the option to run your own VulnerableCode instance. +For details on setting up and configuring your own instance, please refer to the +[VulnerableCode documentation](https://vulnerablecode.readthedocs.io/en/latest/index.html). + ### Choose the output formats ```yaml From cf84010305810af3c2fdf817c27bd5ffdb4b8735 Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 09:27:03 -0700 Subject: [PATCH 68/80] postgres Signed-off-by: tdruez --- action.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/action.yml b/action.yml index bdad9d0..afc7989 100644 --- a/action.yml +++ b/action.yml @@ -16,6 +16,15 @@ inputs: runs: using: "composite" + services: + postgres: + image: postgres:latest + env: + POSTGRES_DB: mydatabase + POSTGRES_USER: myuser + POSTGRES_PASSWORD: mypassword + ports: + - 5432:5432 steps: - uses: actions/setup-python@v5 with: From 6deb8b2c56dfd663d76c318f5f4f7d6d3bb244ba Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 09:29:00 -0700 Subject: [PATCH 69/80] debug Signed-off-by: tdruez --- action.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/action.yml b/action.yml index afc7989..2cd24a3 100644 --- a/action.yml +++ b/action.yml @@ -16,15 +16,6 @@ inputs: runs: using: "composite" - services: - postgres: - image: postgres:latest - env: - POSTGRES_DB: mydatabase - POSTGRES_USER: myuser - POSTGRES_PASSWORD: mypassword - ports: - - 5432:5432 steps: - uses: actions/setup-python@v5 with: @@ -36,13 +27,16 @@ runs: echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV - echo ${{ env.VULNERABLECODE_URL }} + echo $GITHUB_WORKSPACE + ls -la $GITHUB_WORKSPACE - name: Install ScanCode.io shell: bash run: | pip install scancodeio scanpipe migrate + echo $GITHUB_WORKSPACE + ls -la $GITHUB_WORKSPACE - name: Generate pipelines CLI arguments shell: bash From 83dbf9b5f271174c45f352d2496ed4d055be4047 Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 09:48:43 -0700 Subject: [PATCH 70/80] debug Signed-off-by: tdruez --- action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 2cd24a3..5076347 100644 --- a/action.yml +++ b/action.yml @@ -26,9 +26,7 @@ runs: run: | echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV - echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV - echo $GITHUB_WORKSPACE - ls -la $GITHUB_WORKSPACE + echo "SCANCODEIO_DB_NAME=../sqlite3.db" >> $GITHUB_ENV - name: Install ScanCode.io shell: bash From 12d7e26b82fddebf5daf30f7b8c651371e7cc707 Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 09:51:49 -0700 Subject: [PATCH 71/80] debug Signed-off-by: tdruez --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 5076347..d0a3254 100644 --- a/action.yml +++ b/action.yml @@ -33,8 +33,8 @@ runs: run: | pip install scancodeio scanpipe migrate - echo $GITHUB_WORKSPACE - ls -la $GITHUB_WORKSPACE + echo $GITHUB_WORKSPACE/../ + ls -la $GITHUB_WORKSPACE/../ - name: Generate pipelines CLI arguments shell: bash From f8a42428dede8479e53d338bcd59da6d2dc39c78 Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 10:04:54 -0700 Subject: [PATCH 72/80] debug Signed-off-by: tdruez --- .github/workflows/main.yml | 2 ++ action.yml | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0b537f4..929f1c9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,6 +6,8 @@ jobs: name: Scan codebase with ScanCode.io steps: - uses: actions/checkout@v4 + with: + path: scancode-inputs - uses: nexB/scancode-action@alpha with: pipelines: "scan_codebase,find_vulnerabilities" diff --git a/action.yml b/action.yml index d0a3254..106ce0b 100644 --- a/action.yml +++ b/action.yml @@ -7,6 +7,9 @@ inputs: output-formats: description: "Output formats" default: "json xlsx spdx cyclonedx" + inputs-path: + description: "Relative path within the $GITHUB_WORKSPACE for pipeline inputs" + default: ${{ github.workspace }}/scancode-inputs project-name: description: "Name of the project" default: "scancode-action" @@ -26,15 +29,17 @@ runs: run: | echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV - echo "SCANCODEIO_DB_NAME=../sqlite3.db" >> $GITHUB_ENV + echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV - name: Install ScanCode.io shell: bash run: | pip install scancodeio scanpipe migrate - echo $GITHUB_WORKSPACE/../ - ls -la $GITHUB_WORKSPACE/../ + echo $GITHUB_WORKSPACE + ls -la $GITHUB_WORKSPACE + echo ${{ inputs.inputs-path }} + ls -la ${{ inputs.inputs-path }} - name: Generate pipelines CLI arguments shell: bash From 8876e4f3c9225a31095dd0d42e8d79e6346056e4 Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 10:16:13 -0700 Subject: [PATCH 73/80] debug Signed-off-by: tdruez --- .github/workflows/main.yml | 19 +++++++++++++------ README.md | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 929f1c9..f703e59 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,11 +5,18 @@ jobs: runs-on: ubuntu-latest name: Scan codebase with ScanCode.io steps: - - uses: actions/checkout@v4 - with: - path: scancode-inputs +# - uses: actions/checkout@v4 +# with: +# path: scancode-inputs +# - uses: nexB/scancode-action@alpha +# with: +# pipelines: "scan_codebase,find_vulnerabilities" +# env: +# VULNERABLECODE_URL: https://public.vulnerablecode.io/ + - name: Download repository archive to scancode-inputs/ directory + run: | + mkdir -p scancode-inputs + curl -o scancode-inputs/ https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip - uses: nexB/scancode-action@alpha with: - pipelines: "scan_codebase,find_vulnerabilities" - env: - VULNERABLECODE_URL: https://public.vulnerablecode.io/ + pipelines: "scan_single_package" diff --git a/README.md b/README.md index 385671d..fbb62e7 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Run [ScanCode.io](https://github.com/nexB/scancode.io) pipelines from your Workf - [Run a specific pipeline](#run-a-specific-pipeline) - [Run multiple pipelines](#run-multiple-pipelines) - [Choose the output formats](#choose-the-output-formats) + - [Fetch pipelines inputs](#fetch-pipelines-inputs) - [Define a custom project name](#define-a-custom-project-name) - [Where does the scan results go?](#where-does-the-scan-results-go) @@ -28,6 +29,8 @@ Run [ScanCode.io](https://github.com/nexB/scancode.io) pipelines from your Workf ```yaml steps: - uses: actions/checkout@v4 + with: + path: scancode-inputs - uses: nexB/scancode-action@alpha with: pipelines: "scan_codebase" @@ -46,6 +49,10 @@ steps: # The list of output formats to generate. # Default is 'json xlsx spdx cyclonedx' output-formats: + + # Relative path within the $GITHUB_WORKSPACE for pipeline inputs. + # Default is 'scancode-inputs' + inputs-path: # Name of the project. # Default is 'scancode-action' @@ -63,6 +70,8 @@ steps: ```yaml steps: - uses: actions/checkout@v4 + with: + path: scancode-inputs - uses: nexB/scancode-action@alpha ``` @@ -104,6 +113,18 @@ For details on setting up and configuring your own instance, please refer to the output-formats: "json xlsx spdx cyclonedx" ``` +### Fetch pipelines inputs + +```yaml +- name: Download repository archive to scancode-inputs/ directory + run: | + mkdir -p scancode-inputs + curl -o scancode-inputs/ https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip +- uses: nexB/scancode-action@alpha + with: + pipelines: "scan_single_package" +``` + ### Define a custom project name ```yaml From b42038485ddfd544191ca5b2588fe3994fecbe9b Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 10:20:51 -0700 Subject: [PATCH 74/80] debug Signed-off-by: tdruez --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f703e59..699bb3e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: - name: Download repository archive to scancode-inputs/ directory run: | mkdir -p scancode-inputs - curl -o scancode-inputs/ https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip + wget -P scancode-inputs/ https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip - uses: nexB/scancode-action@alpha with: pipelines: "scan_single_package" From 44be1eb9209dc408edd3682b378859aa876eec5f Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 10:22:39 -0700 Subject: [PATCH 75/80] debug Signed-off-by: tdruez --- .github/workflows/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 699bb3e..32c5061 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,8 +15,7 @@ jobs: # VULNERABLECODE_URL: https://public.vulnerablecode.io/ - name: Download repository archive to scancode-inputs/ directory run: | - mkdir -p scancode-inputs wget -P scancode-inputs/ https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip - uses: nexB/scancode-action@alpha with: - pipelines: "scan_single_package" + pipelines: "scan_package" From 223d55ea00adc94c3047b8bd0b8be7ec4920482d Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 10:24:42 -0700 Subject: [PATCH 76/80] debug Signed-off-by: tdruez --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 32c5061..c3345a1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: # VULNERABLECODE_URL: https://public.vulnerablecode.io/ - name: Download repository archive to scancode-inputs/ directory run: | - wget -P scancode-inputs/ https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip + wget --directory-prefix=scancode-inputs https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip - uses: nexB/scancode-action@alpha with: pipelines: "scan_package" From d45a4ea57ff95b7d2adff3884388c0518ff53db4 Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 10:29:22 -0700 Subject: [PATCH 77/80] debug Signed-off-by: tdruez --- README.md | 3 +-- action.yml | 9 ++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index fbb62e7..a258a82 100644 --- a/README.md +++ b/README.md @@ -118,8 +118,7 @@ For details on setting up and configuring your own instance, please refer to the ```yaml - name: Download repository archive to scancode-inputs/ directory run: | - mkdir -p scancode-inputs - curl -o scancode-inputs/ https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip + wget --directory-prefix=scancode-inputs https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip - uses: nexB/scancode-action@alpha with: pipelines: "scan_single_package" diff --git a/action.yml b/action.yml index 106ce0b..03a1fcf 100644 --- a/action.yml +++ b/action.yml @@ -36,10 +36,6 @@ runs: run: | pip install scancodeio scanpipe migrate - echo $GITHUB_WORKSPACE - ls -la $GITHUB_WORKSPACE - echo ${{ inputs.inputs-path }} - ls -la ${{ inputs.inputs-path }} - name: Generate pipelines CLI arguments shell: bash @@ -54,10 +50,9 @@ runs: - name: Create project and run the ${{ inputs.pipelines }} pipelines shell: bash run: | - echo $GITHUB_WORKSPACE - ls -la $GITHUB_WORKSPACE + echo ${{ inputs.inputs-path }} + ls -la ${{ inputs.inputs-path }} scanpipe create-project ${{ inputs.project-name }} \ - --input-url https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip \ ${{ env.PIPELINE_CLI_ARGS }} \ --execute From e9e161b21d51654b0c8b778ed57dc875ba6dff8c Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 10:33:14 -0700 Subject: [PATCH 78/80] debug Signed-off-by: tdruez --- action.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 03a1fcf..55ed3c6 100644 --- a/action.yml +++ b/action.yml @@ -47,22 +47,25 @@ runs: done echo "PIPELINE_CLI_ARGS=${options}" >> $GITHUB_ENV - - name: Create project and run the ${{ inputs.pipelines }} pipelines + - name: Create project with ${{ inputs.pipelines }} pipelines shell: bash run: | - echo ${{ inputs.inputs-path }} - ls -la ${{ inputs.inputs-path }} - scanpipe create-project ${{ inputs.project-name }} \ - ${{ env.PIPELINE_CLI_ARGS }} \ - --execute + scanpipe create-project ${{ inputs.project-name }} ${{ env.PIPELINE_CLI_ARGS }} - - name: Set project work directory path in the environment + - name: Set project work directory in the environment shell: bash run: | 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 + - name: Run the pipelines + shell: bash + run: | + echo ${{ inputs.inputs-path }} + ls -la ${{ inputs.inputs-path }} + scanpipe execute --project ${{ inputs.project-name }} --no-color + - name: Generate outputs id: scanpipe shell: bash From 3ddab4ec57daa97a64f74b1d1ce9725cf61073f5 Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 10:36:14 -0700 Subject: [PATCH 79/80] debug Signed-off-by: tdruez --- action.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 55ed3c6..578f8af 100644 --- a/action.yml +++ b/action.yml @@ -59,12 +59,18 @@ runs: work_directory=$(echo "$project_status" | grep -oP 'Work directory:\s*\K[^\n]+') echo "PROJECT_WORK_DIRECTORY=$work_directory" >> $GITHUB_ENV - - name: Run the pipelines + - name: Copy input files to project work directory shell: bash run: | echo ${{ inputs.inputs-path }} ls -la ${{ inputs.inputs-path }} - scanpipe execute --project ${{ inputs.project-name }} --no-color + cp -r ${{ inputs.inputs-path }}/* ${{ env.PROJECT_WORK_DIRECTORY }}/input/ + echo ${{ env.PROJECT_WORK_DIRECTORY }}/input + ls -la ${{ env.PROJECT_WORK_DIRECTORY }}/input + + - name: Run the pipelines + shell: bash + run: scanpipe execute --project ${{ inputs.project-name }} --no-color - name: Generate outputs id: scanpipe From b910a418b9bb22ac82bbcaeec72f604bddcc8811 Mon Sep 17 00:00:00 2001 From: tdruez Date: Tue, 30 Jan 2024 10:43:56 -0700 Subject: [PATCH 80/80] debug Signed-off-by: tdruez --- .github/workflows/scan-codebase.yml | 15 +++++++++++++++ .github/workflows/{main.yml => scan-package.yml} | 10 +--------- action.yml | 9 ++------- 3 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/scan-codebase.yml rename .github/workflows/{main.yml => scan-package.yml} (53%) diff --git a/.github/workflows/scan-codebase.yml b/.github/workflows/scan-codebase.yml new file mode 100644 index 0000000..929f1c9 --- /dev/null +++ b/.github/workflows/scan-codebase.yml @@ -0,0 +1,15 @@ +on: [push] + +jobs: + scan-codebase: + runs-on: ubuntu-latest + name: Scan codebase with ScanCode.io + steps: + - uses: actions/checkout@v4 + with: + path: scancode-inputs + - uses: nexB/scancode-action@alpha + with: + pipelines: "scan_codebase,find_vulnerabilities" + env: + VULNERABLECODE_URL: https://public.vulnerablecode.io/ diff --git a/.github/workflows/main.yml b/.github/workflows/scan-package.yml similarity index 53% rename from .github/workflows/main.yml rename to .github/workflows/scan-package.yml index c3345a1..314db73 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/scan-package.yml @@ -3,16 +3,8 @@ on: [push] jobs: scan-codebase: runs-on: ubuntu-latest - name: Scan codebase with ScanCode.io + name: Scan package with ScanCode.io steps: -# - uses: actions/checkout@v4 -# with: -# path: scancode-inputs -# - uses: nexB/scancode-action@alpha -# with: -# pipelines: "scan_codebase,find_vulnerabilities" -# env: -# VULNERABLECODE_URL: https://public.vulnerablecode.io/ - name: Download repository archive to scancode-inputs/ directory run: | wget --directory-prefix=scancode-inputs https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_REF}.zip diff --git a/action.yml b/action.yml index 578f8af..20b873c 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: "${{ github.workspace }}/scancode-inputs" project-name: description: "Name of the project" default: "scancode-action" @@ -61,12 +61,7 @@ runs: - name: Copy input files to project work directory shell: bash - run: | - echo ${{ inputs.inputs-path }} - ls -la ${{ inputs.inputs-path }} - cp -r ${{ inputs.inputs-path }}/* ${{ env.PROJECT_WORK_DIRECTORY }}/input/ - echo ${{ env.PROJECT_WORK_DIRECTORY }}/input - ls -la ${{ env.PROJECT_WORK_DIRECTORY }}/input + run: cp -r ${{ inputs.inputs-path }}/* ${{ env.PROJECT_WORK_DIRECTORY }}/input/ - name: Run the pipelines shell: bash