Skip to content

Commit ef7fcba

Browse files
committed
chore: unify calling of apidiff
Following what is done in cluster-api-provider-aws, we always use the Makefile apidiff target. This means we ignore api diffs if the API is not changing.
1 parent 4f90210 commit ef7fcba

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,11 @@ clean-release: ## Remove the release folder
576576
rm -rf $(RELEASE_DIR)
577577

578578
.PHONY: apidiff
579-
apidiff: $(GO_APIDIFF) ## Check for API differences.
579+
apidiff: APIDIFF_OLD_COMMIT ?= $(shell git rev-parse origin/main)
580+
apidiff: $(GO_APIDIFF) ## Check for API differences
580581
@$(call checkdiff) > /dev/null
581582
@if ($(call checkdiff) | grep "api/"); then \
582-
$(GO_APIDIFF) $(shell git rev-parse origin/main) --print-compatible; \
583+
$(GO_APIDIFF) $(APIDIFF_OLD_COMMIT) --print-compatible; \
583584
else \
584585
echo "No changes to 'api/'. Nothing to do."; \
585586
fi

scripts/ci-apidiff.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ set -o pipefail
2020

2121
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2222

23-
APIDIFF="${REPO_ROOT}/hack/tools/bin/go-apidiff"
23+
cd "${REPO_ROOT}"
2424

25-
cd "${REPO_ROOT}" && make "${APIDIFF##*/}"
2625
echo "*** Running go-apidiff ***"
27-
28-
${APIDIFF} "${PULL_BASE_SHA}" --print-compatible
26+
APIDIFF_OLD_COMMIT="${PULL_BASE_SHA}" make apidiff

0 commit comments

Comments
 (0)