Skip to content

Commit fdeb9b4

Browse files
committed
Support ScanCode.io optional dependencies
Also use pip direct URL syntax while installing from branch, see https://packaging.python.org/en/latest/specifications/version-specifiers/#direct-references Resolves: #32 Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent 2c1b7c2 commit fdeb9b4

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

action.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ inputs:
4444
description: "Branch to install ScanCode.io from the GitHub repository (optional)"
4545
required: false
4646
default: ""
47+
scancodeio-extras:
48+
description: "ScanCode.io optional dependencies (comma-separated) (optional)."
49+
required: false
50+
default: ""
4751

4852
runs:
4953
using: "composite"
@@ -84,16 +88,27 @@ runs:
8488
sudo -u postgres psql -c "ALTER USER ${{ env.SCANCODEIO_DB_USER }} WITH ENCRYPTED PASSWORD '${{ env.SCANCODEIO_DB_PASSWORD }}'"
8589
sudo -u postgres createdb --owner=scancodeio --encoding=UTF-8 ${{ env.SCANCODEIO_DB_NAME }}
8690
91+
- name: Generate scancodeio pip install argument
92+
if: env.SCANCODEIO_IS_INSTALLED != 'true'
93+
shell: bash
94+
run: |
95+
SCANCODEIO_PIP_PACKAGE_ARG="scancodeio"
96+
TRIMMED_EXTRAS="$(echo "${{ inputs.scancodeio-extras }}" | tr -d '[:space:]')"
97+
if [ -z "$TRIMMED_EXTRAS" ]; then
98+
SCANCODEIO_PIP_PACKAGE_ARG+="[$TRIMMED_EXTRAS]"
99+
fi
100+
echo "SCANCODEIO_PIP_PACKAGE_ARG=${SCANCODEIO_PIP_PACKAGE_ARG}" >> $GITHUB_ENV
101+
87102
- name: Install ScanCode.io (only if not already installed)
88103
if: env.SCANCODEIO_IS_INSTALLED != 'true'
89104
shell: bash
90105
run: |
91106
if [ -z "${{ inputs.scancodeio-repo-branch }}" ]; then
92-
echo "Installing the latest ScanCode.io release from PyPI"
93-
pip install --upgrade scancodeio
107+
echo "Installing the latest ${{ env.SCANCODEIO_PIP_PACKAGE_ARG }} release from PyPI"
108+
pip install --upgrade "${{ env.SCANCODEIO_PIP_PACKAGE_ARG }}"
94109
else
95-
echo "Installing ScanCode.io from the GitHub branch: ${{ inputs.scancodeio-repo-branch }}"
96-
pip install git+https://github.com/aboutcode-org/scancode.io.git@${{ inputs.scancodeio-repo-branch }}
110+
echo "Installing ${{ env.SCANCODEIO_PIP_PACKAGE_ARG }} from the GitHub branch: ${{ inputs.scancodeio-repo-branch }}"
111+
pip install "${{ env.SCANCODEIO_PIP_PACKAGE_ARG }} @ git+https://github.com/aboutcode-org/scancode.io.git@${{ inputs.scancodeio-repo-branch }}"
97112
fi
98113
99114
- name: Run migrations to prepare the database

0 commit comments

Comments
 (0)