45 lines
1.2 KiB
YAML
45 lines
1.2 KiB
YAML
name: License Check
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
license-check:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Check license headers
|
|
run: |
|
|
# Check if LICENSE file exists
|
|
if [ ! -f "LICENSE" ]; then
|
|
echo "LICENSE file is missing"
|
|
exit 1
|
|
fi
|
|
|
|
echo "License file OK"
|
|
|
|
- name: Check Go files for license headers
|
|
run: |
|
|
# Check for license headers in Go files (optional but good practice)
|
|
missing_headers=0
|
|
|
|
for file in $(find . -name "*.go" -not -path "./vendor/*" -not -path "./.git/*"); do
|
|
if ! head -10 "$file" | grep -q "Copyright"; then
|
|
echo "Missing license header in: $file"
|
|
missing_headers=$((missing_headers + 1))
|
|
fi
|
|
done
|
|
|
|
if [ $missing_headers -gt 0 ]; then
|
|
echo "Found $missing_headers Go files without license headers"
|
|
echo "Consider adding license headers to Go files"
|
|
# Don't fail the build, just warn
|
|
else
|
|
echo "All Go files have license headers"
|
|
fi
|