diff --git a/Makefile b/Makefile index 7ce7ea196c..88863bcf13 100644 --- a/Makefile +++ b/Makefile @@ -314,9 +314,11 @@ verify-gen: generate ## Verify generated files echo "generated files are out of date, run make generate"; exit 1; \ fi +APIDIFF_OLD_COMMIT ?= $(shell git rev-parse origin/main) + .PHONY: apidiff apidiff: $(GO_APIDIFF) ## Check for API differences - $(GO_APIDIFF) $(shell git rev-parse origin/main) --print-compatible + $(GO_APIDIFF) $(APIDIFF_OLD_COMMIT) --print-compatible ##@ build: diff --git a/scripts/ci-apidiff.sh b/scripts/ci-apidiff.sh index 1e9e041457..b60a9126c4 100755 --- a/scripts/ci-apidiff.sh +++ b/scripts/ci-apidiff.sh @@ -19,9 +19,8 @@ set -o nounset set -o pipefail REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. -APIDIFF="${REPO_ROOT}/hack/tools/bin/go-apidiff" -cd "${REPO_ROOT}" && make apidiff -echo "*** Running go-apidiff ***" +cd "${REPO_ROOT}" -${APIDIFF} "${PULL_BASE_SHA}" --print-compatible +echo "*** Running go-apidiff ***" +APIDIFF_OLD_COMMIT="${PULL_BASE_SHA}" make apidiff