-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (47 loc) · 1.61 KB
/
license-check.yml
File metadata and controls
57 lines (47 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: License Compliance
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -e ".[dev,redis,a2a]" pip-licenses
- name: Check license compatibility
run: |
echo "=== Dependency Licenses ==="
pip-licenses --format=table --with-urls || true
echo ""
echo "=== Checking for incompatible licenses ==="
pip-licenses --format=json --output-file=licenses.json || true
python -c "
import json, sys, os
if not os.path.exists('licenses.json') or os.path.getsize('licenses.json') == 0:
print('WARNING: Could not generate license report')
sys.exit(0)
with open('licenses.json') as f:
licenses = json.load(f)
blocked_patterns = ['gpl-3.0', 'agpl-3.0', 'sspl-1.0']
found = []
for pkg in licenses:
lic = pkg.get('License', '') or ''
for b in blocked_patterns:
if b in lic.lower():
found.append(f\" {pkg.get('Name', '?')} ({lic})\")
if found:
print('FAIL: Found incompatible licenses:')
for f in found:
print(f)
sys.exit(1)
print(f'OK: All {len(licenses)} dependency licenses are compatible with Apache 2.0')
"