CI: Check license headers of Go files.

This commit is contained in:
Joachim Bauch 2023-12-21 13:51:32 +01:00
parent 110ece7626
commit 682d3aa52a
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02

46
.github/workflows/licensecheck.yml vendored Normal file
View file

@ -0,0 +1,46 @@
name: licensecheck
on:
push:
branches: [ master ]
paths:
- '.github/workflows/licensecheck.yml'
- '**.go'
pull_request:
branches: [ master ]
paths:
- '.github/workflows/licensecheck.yml'
- '**.go'
permissions:
contents: read
jobs:
golang:
name: golang
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install licensecheck
run: |
sudo apt-get -y update
sudo apt-get -y install licensecheck
- id: licensecheck
name: Check licenses
run: |
{
echo 'CHECK_RESULT<<EOF'
licensecheck *.go */*.go
echo EOF
} >> "$GITHUB_ENV"
- name: Check for missing licenses
run: |
MISSING=$(echo "$CHECK_RESULT" | grep UNKNOWN || true)
if [ -n "$MISSING" ]; then \
echo "$MISSING"; \
exit 1; \
fi