Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

License checks #44

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 38 additions & 5 deletions .github/workflows/license-compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,46 @@ jobs:
run: |
. venv/bin/activate
pip install pip-licenses
pip-licenses --from=mixed --output-file=dependencies_licenses.txt
pip-licenses --from=mixed --output-file=dependency_licenses.json --format=json

- name: Upload license reports
uses: actions/upload-artifact@v3
- name: 'Parse Dependency licenses'
id: parse-dependency-licenses
run: |
dependency_licenses=$(cat dependency_licenses.json)
echo "::set-output name=dependency-licenses::${dependency_licenses}"

- name: 'Compare Dependency licenses'
id: compare-dependency-licenses
run: |
dependency_licenses=$(cat dependency_licenses.json)
echo "Dependency licenses content:"
echo "${dependency_licenses}"

permitted_licenses="MIT License,Apache-2.0,BSD,EPL1" # Updated permitted licenses list

for package_info in $(echo "${dependency_licenses}" | jq -c '.[]'); do
package_name=$(echo "${package_info}" | jq -r '.Name')
license=$(echo "${package_info}" | jq -r '.License')

if [[ ! ",${permitted_licenses}," =~ ",${license}," ]]; then
echo "Error: Package ${package_name} has an unrecognized license: ${license}"
exit 1
fi
done

- name: 'Upload Dependency License Report'
if: always()
uses: actions/upload-artifact@v2
with:
name: dependency-license-report
path: dependency_licenses.json

- name: 'Upload License Compliance Results'
if: always()
uses: actions/upload-artifact@v2
with:
name: dependencies-license-reports
path: dependencies_licenses.txt
name: license-compliance-results
path: license_compliance_results.txt

- name: License compliance summary
run: echo "License compliance check completed. See artifacts for details."
Loading