diff --git a/.github/workflows/acceptable-licenses.txt b/.github/workflows/acceptable-licenses.txt index 1fb00afa..a6c60c20 100644 --- a/.github/workflows/acceptable-licenses.txt +++ b/.github/workflows/acceptable-licenses.txt @@ -39,11 +39,10 @@ The Apache License, Version 2.0 The Apache Software License, Version 2.0 The BSD License -The GNU General Public License (GPL), Version 2, With Classpath Exception The GNU Lesser General Public License, Version 2.1 The MIT License (MIT) The MIT License Unicode/ICU License Universal Permissive License, Version 1.0 W3C license -jQuery license +jQuery license \ No newline at end of file diff --git a/.github/workflows/license-check.yml b/.github/workflows/license-check.yml index bc3e7a1e..d97405c1 100644 --- a/.github/workflows/license-check.yml +++ b/.github/workflows/license-check.yml @@ -40,12 +40,10 @@ jobs: run: mvn org.codehaus.mojo:license-maven-plugin:2.0.0:download-licenses - name: Validate XML report run: | - ALLOW_LICENSES=`cat .github/workflows/acceptable-licenses.txt` - find . -name licenses.xml | awk '{print "cat " $1}' | sh | xq "//dependency[licenses/license/name!=${{ env.ALLOW_LICENSES }}] | sort | uniq > target/complete-licenses.txt - comm -23 target/complete-licenses.txt .github/workflows/acceptable-licenses.txt > target/license-report.txt - LINES_FOUND=`cat target/license-report.txt | wc -l` - echo "License issues found ..." - if [ $LINES_FOUND -gt 1 ]; then cat target/license-report.txt ; exit -1; fi + ALLOW_LICENSES=`cat .github/workflows/acceptable-licenses.txt | sed "s//license/license/name!='/" | sed "s//' | tr -s '\n' '!' | sed 's/\!/ or /g' ` + find . -name licenses.xml -exec xq "//dependency[count(licenses/license[${ALLOW_LICENSES}])=0]" {} \; > target/license-issues.xml + LINES_FOUND=`cat target/license-issues.xml | wc -l` + if [ $LINES_FOUND -gt 3 ]; then cat target/license-report.txt ; exit -1; fi working-directory: maven - name: Upload license reports uses: actions/upload-artifact@v3