@@ -83,23 +83,24 @@ runs:
8383 INPUT_IMAGE : ${{ inputs.scancodeio-image }}
8484 run : |
8585 echo "SECRET_KEY=$(openssl rand -base64 32)" >> "$GITHUB_ENV"
86- echo "SCANCODEIO_DB_NAME=scancodeio" >> "$GITHUB_ENV"
87- echo "SCANCODEIO_DB_USER=scancodeio" >> "$GITHUB_ENV"
88- echo "SCANCODEIO_DB_PASSWORD=scancodeio" >> "$GITHUB_ENV"
8986 # Workspace location mounted into the container, so outputs are directly accessible
9087 echo "SCANCODEIO_WORKSPACE_LOCATION=/workspace/.scancodeio" >> "$GITHUB_ENV"
9188 echo "SCANCODEIO_IMAGE=$INPUT_IMAGE" >> "$GITHUB_ENV"
9289 # Sanitize project name for artifact usage
93- SAFE_PROJECT_NAME="${INPUT_PROJECT_NAME//[^a-zA-Z0-9._-]/_}"
94- echo "SAFE_PROJECT_NAME=$SAFE_PROJECT_NAME" >> "$GITHUB_ENV"
90+ echo "SAFE_PROJECT_NAME=${INPUT_PROJECT_NAME//[^a-zA-Z0-9._-]/_}" >> "$GITHUB_ENV"
9591
9692 - name : Start and setup the PostgreSQL service
9793 shell : bash
9894 run : |
99- sudo systemctl start postgresql.service
100- sudo -u postgres createuser --no-createrole --no-superuser --login --inherit --createdb "$SCANCODEIO_DB_USER"
101- sudo -u postgres psql -c "ALTER USER $SCANCODEIO_DB_USER WITH ENCRYPTED PASSWORD '$SCANCODEIO_DB_PASSWORD'"
102- sudo -u postgres createdb --owner=scancodeio --encoding=UTF-8 "$SCANCODEIO_DB_NAME"
95+ if ! sudo systemctl is-active --quiet postgresql; then
96+ sudo systemctl start postgresql.service
97+ sudo -u postgres psql -c "CREATE USER scancodeio WITH CREATEDB ENCRYPTED PASSWORD scancodeio;"
98+ sudo -u postgres createdb --owner=scancodeio --encoding=UTF-8 scancodeio
99+ fi
100+
101+ - name : Pull the ScanCode.io image
102+ shell : bash
103+ run : docker pull "$SCANCODEIO_IMAGE"
103104
104105 - name : Write scanpipe wrapper script
105106 shell : bash
@@ -122,10 +123,6 @@ runs:
122123 chmod +x "$RUNNER_TEMP/scanpipe"
123124 echo "$RUNNER_TEMP" >> "$GITHUB_PATH"
124125
125- - name : Pull the ScanCode.io image
126- shell : bash
127- run : docker pull "$SCANCODEIO_IMAGE"
128-
129126 - name : Run migrations to prepare the database
130127 shell : bash
131128 run : scanpipe migrate --verbosity 0
0 commit comments