Skip to content

Commit

Permalink
Check third-party licenses on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
mariomac committed Oct 29, 2024
1 parent 4f7e880 commit c0bcf5a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .github/workflows/pull_request_check_license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Check third-party licenses

on:
push:
branches: [ 'main', 'release-*' ]
pull_request:
branches: [ 'main', 'release-*' ]

jobs:
check-licenses:
name: check-licenses
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.23' ]
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Check licenses
run: make check-licenses
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,18 @@ oats-test: oats-test-sql oats-test-redis oats-test-kafka
oats-test-debug: oats-prereq
cd test/oats/kafka && TESTCASE_BASE_PATH=./yaml TESTCASE_MANUAL_DEBUG=true TESTCASE_TIMEOUT=1h $(GINKGO) -v -r

.PHONY: update-licenses
.PHONY: update-licenses check-license
update-licenses: prereqs
@echo "### Updating third_party_licenses.csv"
$(GO_LICENSES) report --include_tests ./... > third_party_licenses.csv

check-licenses: update-licenses
@echo "### Checking third party licenses"
@if [ "$(strip $(shell git diff HEAD third_party_licenses.csv))" != "" ]; then \
echo "ERROR: third_party_licenses.csv is not up to date. Run 'make update-licenses' and push the changes to your PR"; \
exit 1; \
fi

.PHONY: artifact
artifact: compile
@echo "### Packing generated artifact"
Expand Down

0 comments on commit c0bcf5a

Please sign in to comment.