diff --git a/.github/workflows/check-generated-files.yml b/.github/workflows/check-generated-files.yml index 9b3d9c13e3..c0ed4cd18f 100644 --- a/.github/workflows/check-generated-files.yml +++ b/.github/workflows/check-generated-files.yml @@ -83,6 +83,11 @@ jobs: PROTOC_GEN_VERSION=v1.34.2 PROTOC_GRPC_VERSION=v1.4.0 + # Export the variables so they are available in future steps + echo "PROTOC_VERSION=$PROTOC_VERSION" >> $GITHUB_ENV + echo "PROTOC_GEN_VERSION=$PROTOC_GEN_VERSION" >> $GITHUB_ENV + echo "PROTOC_GRPC_VERSION=$PROTOC_GRPC_VERSION" >> $GITHUB_ENV + # Download and install protoc PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip curl -0L -o $PROTOC_ZIP https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP @@ -110,6 +115,8 @@ jobs: for p in $(find . -name "*.pb.go"); do if ! cmp -s $p $p.tmp; then echo "Error: Proto file and generated Go file $p are out of sync!" + echo "Here is the difference:" + diff $p $p.tmp || true echo "Please run 'make proto' with protoc version $PROTOC_VERSION, protoc-gen-go version $PROTOC_GEN_VERSION and protoc-gen-go-grpc version $PROTOC_GRPC_VERSION and commit the changes." exit 1 fi diff --git a/.github/workflows/check-license.yaml b/.github/workflows/check-license.yaml index 4423181ffe..7b97d2b86b 100644 --- a/.github/workflows/check-license.yaml +++ b/.github/workflows/check-license.yaml @@ -20,12 +20,21 @@ jobs: - name: Check License Header run: | - CHECK=$(grep -rcL --exclude-dir={.git,build,**vernemq**} \ + CHECK="" + for file in $(grep -rl --exclude-dir={.git,build,**vernemq**} \ --exclude=\*.{crt,key,pem,zed,hcl,md,json,csv,mod,sum,tmpl,args} \ --exclude={CODEOWNERS,LICENSE,MAINTAINERS} \ - --regexp "Copyright (c) Abstract Machines" .) + .); do + + if ! head -n 5 "$file" | grep -q "Copyright (c) Abstract Machines"; then + CHECK="$CHECK $file" + fi + done + if [ "$CHECK" ]; then echo "License header check failed. Fix the following files:" echo "$CHECK" exit 1 + else + echo "All files have the correct license header!" fi