From 252fafa53a0c75a57d8dfa8226487e7095609ef0 Mon Sep 17 00:00:00 2001 From: Nick DeLuca Date: Wed, 30 Nov 2022 11:48:00 -0700 Subject: [PATCH] Fix remote check proto breaking when not branching from master (#1409) * fix check remote breaking when not branching from master -- always use current git branch when ref'ing * fix remote command when overridden --- .github/workflows/proto.yml | 2 +- build/proto.mk | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index e1a08f61..5bb91f52 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -20,7 +20,7 @@ jobs: - run: make check-proto-lint - run: make check-proto-format - run: make check-proto-breaking-remote - - run: BUF_CHECK_BREAKING_AGAINST="branch=$GITHUB_BASE_REF" make check-proto-breaking-remote + - run: BUF_CHECK_BREAKING_AGAINST_REMOTE="branch=$GITHUB_BASE_REF" make check-proto-breaking-remote if: github.event_name == 'pull_request' - run: make check-proto-gen - run: make check-proto-gen-doc diff --git a/build/proto.mk b/build/proto.mk index 6f77fc21..9fab8de5 100644 --- a/build/proto.mk +++ b/build/proto.mk @@ -44,6 +44,7 @@ check-proto-format: proto-format @git diff --exit-code proto/**/*.proto > /dev/null || (echo "Protobuf format is not up to date! Please run \`make proto-format\`."; exit 1) BUF_CHECK_BREAKING_AGAINST ?= ref=HEAD~1 +BUF_CHECK_BREAKING_AGAINST_REMOTE ?= branch=$(GIT_BRANCH),$(BUF_CHECK_BREAKING_AGAINST) .PHONY: check-proto-breaking check-proto-breaking: install-build-deps @@ -53,7 +54,7 @@ check-proto-breaking: install-build-deps .PHONY: check-proto-breaking-remote check-proto-breaking-remote: install-build-deps @echo "Checking for proto backward compatibility" - @$(BUF) breaking --against '$(HTTPS_GIT)#$(BUF_CHECK_BREAKING_AGAINST)' + $(BUF) breaking --against '$(HTTPS_GIT)#$(BUF_CHECK_BREAKING_AGAINST_REMOTE)' .PHONY: proto-gen-all proto-gen-all: proto-gen proto-gen-doc proto-gen-swagger