Skip to content

Commit

Permalink
add licenses check to make sure deploy update licenses
Browse files Browse the repository at this point in the history
Signed-off-by: LiZhenCheng9527 <[email protected]>
  • Loading branch information
LiZhenCheng9527 committed Jan 16, 2024
1 parent c4c4ff8 commit ce233bd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 213 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
uses: actions/checkout@v3
- name: generate license mirror
run: |
make mirror-licenses
make licenses-check
- name: lint-licenses
# if restricted > 0, CI will report an error.
run: |
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ mod-download-go:
@-GOFLAGS="-mod=readonly" find -name go.mod -execdir go mod download \;
# go mod tidy is needed with Golang 1.16+ as go mod download affects go.sum
# https://github.com/golang/go/issues/43994
@find -name go.mod -execdir go mod tidy \;
# exclude docs folder
@find . -path ./docs -prune -o -name go.mod -execdir go mod tidy \;

.PHONY: mirror-licenses
mirror-licenses: mod-download-go; \
Expand All @@ -108,6 +109,10 @@ mirror-licenses: mod-download-go; \
lint-licenses:
@if test -d licenses; then license-lint --config common/config/license-lint.yaml; fi

.PHONY: licenses-check
licenses-check: mirror-licenses; \
hack/gen-check.sh

fix-copyright:
@${FINDFILES} \( -name '*.go' -o -name '*.cc' -o -name '*.h' -o -name '*.proto' -o -name '*.py' -o -name '*.sh' \) \( ! \( -name '*.gen.go' -o -name '*.pb.go' -o -name '*_pb2.py' \) \) -print0 |\
${XARGS} hack/fix_copyright_banner.sh
Expand Down
8 changes: 8 additions & 0 deletions hack/licenses-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

if [[ -n $(git status --porcelain) ]]; then
git status
git diff
echo "ERROR: Some files need to be updated, please run 'make mirror-licenses' and include any changed files in your PR"
exit 1
fi
9 changes: 0 additions & 9 deletions licenses/github.com/golang-jwt/jwt/v4/LICENSE

This file was deleted.

202 changes: 0 additions & 202 deletions licenses/google.golang.org/appengine/LICENSE

This file was deleted.

0 comments on commit ce233bd

Please sign in to comment.