@@ -10,9 +10,16 @@ inputs:
1010 inputs-path :
1111 description : " Relative path within the $GITHUB_WORKSPACE for pipeline inputs"
1212 default : " ${{ github.workspace }}/scancode-inputs"
13+ input-urls :
14+ description : ' Provide one or more URLs to download for the pipeline run execution'
15+ required : false
16+ default : " "
1317 project-name :
1418 description : " Name of the project"
1519 default : " scancode-action"
20+ outputs-archive-name :
21+ description : " Name of the outputs archive"
22+ default : " scancode-outputs"
1623 python-version :
1724 description : " Python version"
1825 default : " 3.11"
@@ -28,29 +35,49 @@ runs:
2835 shell : bash
2936 run : |
3037 echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV
31- echo "SCANCODEIO_DB_ENGINE=django.db.backends.sqlite3" >> $GITHUB_ENV
32- echo "SCANCODEIO_DB_NAME=sqlite3.db" >> $GITHUB_ENV
38+ echo "SCANCODEIO_DB_NAME=scancodeio" >> $GITHUB_ENV
39+ echo "SCANCODEIO_DB_USER=scancodeio" >> $GITHUB_ENV
40+ echo "SCANCODEIO_DB_PASSWORD=scancodeio" >> $GITHUB_ENV
41+
42+ - name : Start and setup the PostgreSQL service
43+ shell : bash
44+ run : |
45+ sudo systemctl start postgresql.service
46+ sudo -u postgres createuser --no-createrole --no-superuser --login --inherit --createdb ${{ env.SCANCODEIO_DB_USER }}
47+ sudo -u postgres psql -c "ALTER USER ${{ env.SCANCODEIO_DB_USER }} WITH encrypted password '${{ env.SCANCODEIO_DB_PASSWORD }}'"
48+ sudo -u postgres createdb --owner=scancodeio --encoding=UTF-8 ${{ env.SCANCODEIO_DB_NAME }}
3349
3450 - name : Install ScanCode.io
3551 shell : bash
3652 run : |
37- pip install scancodeio
53+ pip install --upgrade scancodeio
3854 scanpipe migrate
3955
40- - name : Generate pipelines CLI arguments
56+ - name : Generate `--pipeline` CLI arguments
4157 shell : bash
4258 run : |
4359 IFS=',' read -ra PIPELINES <<< "${{ inputs.pipelines }}"
44- options =""
60+ PIPELINE_CLI_ARGS =""
4561 for pipeline in "${PIPELINES[@]}"; do
46- options+="--pipeline $pipeline "
62+ PIPELINE_CLI_ARGS+=" --pipeline $pipeline"
63+ done
64+ echo "PIPELINE_CLI_ARGS=${PIPELINE_CLI_ARGS}" >> $GITHUB_ENV
65+
66+ - name : Generate `--input-url` CLI arguments
67+ shell : bash
68+ run : |
69+ INPUT_URL_CLI_ARGS=""
70+ for url in ${{ inputs.input-urls }}; do
71+ INPUT_URL_CLI_ARGS+=" --input-url $url"
4772 done
48- echo "PIPELINE_CLI_ARGS =${options }" >> $GITHUB_ENV
73+ echo "INPUT_URL_CLI_ARGS =${INPUT_URL_CLI_ARGS }" >> $GITHUB_ENV
4974
50- - name : Create project with ${{ inputs.pipelines }} pipelines
75+ - name : Create project
5176 shell : bash
5277 run : |
53- scanpipe create-project ${{ inputs.project-name }} ${{ env.PIPELINE_CLI_ARGS }}
78+ scanpipe create-project ${{ inputs.project-name }} \
79+ ${{ env.PIPELINE_CLI_ARGS }} \
80+ ${{ env.INPUT_URL_CLI_ARGS }}
5481
5582 - name : Set project work directory in the environment
5683 shell : bash
6188
6289 - name : Copy input files to project work directory
6390 shell : bash
64- run : cp -r ${{ inputs.inputs-path }}/* ${{ env.PROJECT_WORK_DIRECTORY }}/input/
91+ run : |
92+ SOURCE_PATH="${{ inputs.inputs-path }}"
93+ DESTINATION_PATH="${{ env.PROJECT_WORK_DIRECTORY }}/input/"
94+ if [ -d "$SOURCE_PATH" ]; then
95+ cp -r "$SOURCE_PATH"/* "$DESTINATION_PATH"
96+ fi
6597
6698 - name : Run the pipelines
6799 shell : bash
70102 - name : Generate outputs
71103 id : scanpipe
72104 shell : bash
73- run : scanpipe output
105+ run : scanpipe output
74106 --project ${{ inputs.project-name }}
75107 --format ${{ inputs.output-formats }}
76108 --no-color
79111 uses : actions/upload-artifact@v4
80112 id : artifact-upload-step
81113 with :
82- name : scanpipe- outputs
114+ name : ${{ inputs. outputs-archive-name }}
83115 path : ${{ env.PROJECT_WORK_DIRECTORY }}/output/*
0 commit comments