|
1 | 1 | name: "ScanCode action" |
2 | 2 | description: "Run ScanCode.io pipelines in your workflows" |
| 3 | + |
3 | 4 | inputs: |
4 | 5 | pipelines: |
5 | 6 | description: "Names of the pipelines (comma-separated) and in order." |
@@ -63,19 +64,23 @@ runs: |
63 | 64 | shell: bash |
64 | 65 | run: | |
65 | 66 | sudo systemctl start postgresql.service |
66 | | - sudo -u postgres createuser --no-createrole --no-superuser --login --inherit --createdb ${{ env.SCANCODEIO_DB_USER }} |
67 | | - sudo -u postgres psql -c "ALTER USER ${{ env.SCANCODEIO_DB_USER }} WITH encrypted password '${{ env.SCANCODEIO_DB_PASSWORD }}'" |
68 | | - sudo -u postgres createdb --owner=scancodeio --encoding=UTF-8 ${{ env.SCANCODEIO_DB_NAME }} |
| 67 | + sudo -u postgres createuser --no-createrole --no-superuser --login --inherit --createdb ${{ env.SCANCODEIO_DB_USER }} || true |
| 68 | + sudo -u postgres psql -c "ALTER USER ${{ env.SCANCODEIO_DB_USER }} WITH ENCRYPTED PASSWORD '${{ env.SCANCODEIO_DB_PASSWORD }}'" || true |
| 69 | + sudo -u postgres createdb --owner=scancodeio --encoding=UTF-8 ${{ env.SCANCODEIO_DB_NAME }} || true |
69 | 70 |
|
70 | | - - name: Install ScanCode.io |
| 71 | + - name: Install ScanCode.io (only if not already installed) |
71 | 72 | shell: bash |
72 | 73 | run: | |
73 | | - if [ -z "${{ inputs.scancodeio-repo-branch }}" ]; then |
74 | | - echo "Installing the latest ScanCode.io release from PyPI" |
75 | | - pip install --upgrade scancodeio |
| 74 | + if ! command -v scanpipe &> /dev/null; then |
| 75 | + if [ -z "${{ inputs.scancodeio-repo-branch }}" ]; then |
| 76 | + echo "Installing the latest ScanCode.io release from PyPI" |
| 77 | + pip install --upgrade scancodeio |
| 78 | + else |
| 79 | + echo "Installing ScanCode.io from the GitHub branch: ${{ inputs.scancodeio-repo-branch }}" |
| 80 | + pip install git+https://github.com/aboutcode-org/scancode.io.git@${{ inputs.scancodeio-repo-branch }} |
| 81 | + fi |
76 | 82 | else |
77 | | - echo "Installing ScanCode.io from the GitHub branch: ${{ inputs.scancodeio-repo-branch }}" |
78 | | - pip install git+https://github.com/aboutcode-org/scancode.io.git@${{ inputs.scancodeio-repo-branch }} |
| 83 | + echo "ScanCode.io already installed, skipping installation." |
79 | 84 | fi |
80 | 85 |
|
81 | 86 | - name: Run migrations to prepare the database |
|
0 commit comments