Skip to content

Commit 57c9fef

Browse files
committed
Inject the check licenses script to the workflow
1 parent 9ef7dde commit 57c9fef

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

.github/workflows/quality-checks.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,37 @@ jobs:
5454
run: |
5555
make install
5656
57+
- name: Check if project uses Poetry
58+
id: check_poetry
59+
run: |
60+
if [ -f pyproject.toml ] && grep -q '\[tool.poetry\]' pyproject.toml; then
61+
echo "uses_poetry=true" >> $GITHUB_OUTPUT
62+
else
63+
echo "uses_poetry=false" >> $GITHUB_OUTPUT
64+
fi
65+
66+
- name: Check licenses (Python)
67+
if: steps.check_poetry.outputs.uses_poetry == 'true'
68+
run: |
69+
#!/bin/bash
70+
set -euo pipefail
71+
72+
# Install pip-licenses if not already installed
73+
if ! poetry run pip show pip-licenses > /dev/null 2>&1; then
74+
poetry run pip install pip-licenses
75+
fi
76+
77+
LICENSES=$(poetry run pip-licenses)
78+
INCOMPATIBLE_LIBS=$(echo "$LICENSES" | grep 'GPL' || true)
79+
80+
if [[ -z $INCOMPATIBLE_LIBS ]]; then
81+
exit 0
82+
else
83+
echo "The following libraries were found which are not compatible with this project's license:"
84+
echo "$INCOMPATIBLE_LIBS"
85+
exit 1
86+
fi
87+
5788
- name: Generate and check SBOMs
5889
uses: NHSDigital/eps-action-sbom@v1
5990
with:
@@ -65,9 +96,6 @@ jobs:
6596
name: SBOMS
6697
path: '**/*sbom*.json'
6798

68-
- name: Check licenses
69-
run: make check-licenses
70-
7199
- name: Run linting for TypeScript and Python
72100
run: make lint
73101

0 commit comments

Comments
 (0)