Skip to content
Merged
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
55 changes: 54 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
build:
name: Build package
runs-on: ubuntu-latest
needs: lint
needs: [lint, license-check]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
Expand All @@ -67,3 +67,56 @@ jobs:
with:
name: dist
path: dist/

# ============ License Compliance ============
license-check:
name: License Compliance
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Check NOTICE and THIRD_PARTY_LICENSES.md
run: |
BASE="origin/${{ github.base_ref }}"

# On push events there is no base_ref; nothing to diff against.
if [ "${{ github.event_name }}" != "pull_request" ]; then
echo "✅ Push event — license check skipped."
exit 0
fi

CHANGED=$(git diff --name-only "$BASE"...HEAD)

if echo "$CHANGED" | grep -q "pyproject.toml"; then
echo "::notice::pyproject.toml changed — verifying license files are updated"

NOTICE_OK=false
LICENSES_OK=false
FAILED=false

echo "$CHANGED" | grep -qx "NOTICE" && NOTICE_OK=true
echo "$CHANGED" | grep -qx "THIRD_PARTY_LICENSES.md" && LICENSES_OK=true

if [ "$LICENSES_OK" = false ]; then
echo "::error::pyproject.toml changed but THIRD_PARTY_LICENSES.md was not updated."
echo ""
echo "Please update THIRD_PARTY_LICENSES.md to reflect the dependency changes."
FAILED=true
fi

if [ "$NOTICE_OK" = false ]; then
echo "::error::pyproject.toml changed but NOTICE was not updated."
echo ""
echo "Please update NOTICE to reflect the dependency changes."
FAILED=true
fi

if [ "$FAILED" = true ]; then
exit 1
fi

echo "✅ License files updated alongside dependency changes."
else
echo "✅ No dependency changes — license check skipped."
fi