Skip to content

Commit

Permalink
Update license-compliance.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
samsemasen committed Jul 17, 2024
1 parent 734c866 commit 0ec685c
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/license-compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,17 @@ jobs:
echo "Dependency licenses content:"
echo "${dependency_licenses}"
permitted_licenses="MIT,Apache-2.0,BSD,EPL1"
non_compliant_packages=""
for package in $(echo "${dependency_licenses}" | jq -r '.[] | .Package')
do
license=$(echo "${dependency_licenses}" | jq -r --arg package "$package" '.[] | select(.Package == $package) | .License')
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 has an unrecognized license: $license"
non_compliant_packages+="Package $package has an unrecognized license: $license\n"
echo "Error: Package ${package_name} has an unrecognized license: ${license}"
exit 1
fi
done
echo "::set-output name=non-compliant-packages::${non_compliant_packages}"
if [ -n "${non_compliant_packages}" ]; then
exit 1
fi
- name: 'Upload Dependency License Report'
if: always()
Expand Down

0 comments on commit 0ec685c

Please sign in to comment.