@@ -61,13 +61,79 @@ jobs:
6161 ls src/pgm_build_dependencies/eigen/
6262 ls src/pgm_build_dependencies/msgpack_cxx/
6363
64+ - name : License scan - entire repository
65+ uses : fossology/fossology-action@v1
66+ continue-on-error : true
67+ with :
68+ scan_mode : repo
69+ scanners : ' nomos ojo'
70+ report_format : ' SPDX_JSON'
71+
72+ - name : Install jq
73+ run : sudo apt-get update && sudo apt-get install -y jq
74+
75+ - name : Remove files with non-accepted license
76+ id : license-cleanup
77+ run : |
78+ # Find the SPDX JSON file
79+ SPDX_FILE=$(find . -name "*spdx*.json" -o -name "sbom*.json" -o -name "*sbom.json"| head -1)
80+
81+ if [ -z "$SPDX_FILE" ]; then
82+ echo "No SPDX JSON file found! Fossology scan may have failed."
83+ echo "Available files:"
84+ find . -name "*.json" || echo "No JSON files found"
85+ exit 1
86+ fi
87+ echo "Found SPDX file: $SPDX_FILE"
88+
89+ # Get badly licensed files (excluding .git and .github directories)
90+ echo "Extracting and deduplicating badly licensed files..."
91+ BAD_FILES=$(jq -r '
92+ [.files[] |
93+ select(.licenseInfoInFiles[]? | type == "string" and test("GPL"; "i")) |
94+ select(.fileName | test("^\\.git/") | not) |
95+ select(.fileName | test("^\\.github/") | not) |
96+ .fileName] |
97+ unique |
98+ .[]
99+ ' "$SPDX_FILE")
100+
101+ if [ -z "$BAD_FILES" ]; then
102+ echo "No badly licensed files found - nothing to delete!"
103+ else
104+ echo "Badly licensed files found:"
105+ echo "$BAD_FILES" | while read -r file_name; do
106+ if [ -n "$file_name" ]; then
107+ echo " - $file_name"
108+
109+ if [ -f "$file_name" ]; then
110+ rm -f "$file_name"
111+ echo "Deleted: $file_name"
112+ else
113+ echo "File not found: $file_name"
114+ exit 1
115+ fi
116+ fi
117+ done
118+ fi
119+
120+ - name : License cleanup completed
121+ run : echo "License cleanup completed successfully"
122+
123+ - name : Upload Scan Results Artifact
124+ uses : actions/upload-artifact@v4
125+ with :
126+ name : license-scan-results
127+ path : results/
128+
64129 - name : build wheel
65130 run : |
66131 python -m build --wheel --outdir dist
67132 ls dist/
68133 echo "VERSION=v$(date +'%Y.%m.%d')" >> $GITHUB_ENV
69134
70135 - name : Commit and push changes
136+ if : ${{ github.event_name == 'schedule' || inputs.force_publish }}
71137 id : commit
72138 uses : stefanzweifel/git-auto-commit-action@v7
73139 with :
78144 commit_author : GitHub Actions Bot <actions@github.com>
79145
80146 - name : publish
81- if : ${{ inputs.force_publish || steps.commit.outputs.changes_detected == 'true' }}
147+ if : ${{ inputs.force_publish || ( steps.commit.outputs.changes_detected == 'true' && github.event_name == 'schedule') }}
82148 uses : softprops/action-gh-release@v2
83149 with :
84150 tag_name : ${{ env.VERSION }}
0 commit comments