Skip to content

Commit 5fff1ab

Browse files
committed
Apidiff test runs only if the changes are in api/ and exp/api/
Signed-off-by: Meghana Jangi <[email protected]>
1 parent c55fe55 commit 5fff1ab

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,11 @@ clean-temporary: ## Remove all temporary files and folders.
191191
clean-release: ## Remove the release folder.
192192
rm -rf $(RELEASE_DIR)
193193

194+
APIDIFF_OLD_COMMIT ?= $(shell git rev-parse origin/main)
195+
194196
.PHONY: apidiff
195197
apidiff: $(GO_APIDIFF) ## Check for API differences.
196-
$(GO_APIDIFF) $(shell git rev-parse origin/main) --print-compatible
198+
$(GO_APIDIFF) $(APIDIFF_OLD_COMMIT) --print-compatible
197199

198200
.PHONY: format-tiltfile
199201
format-tiltfile: ## Format the Tiltfile.

scripts/ci-apidiff.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ set -o nounset
1919
set -o pipefail
2020

2121
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
22-
23-
APIDIFF="${REPO_ROOT}/hack/tools/bin/go-apidiff"
24-
25-
cd "${REPO_ROOT}" && make "${APIDIFF##*/}"
22+
cd "${REPO_ROOT}"
2623
echo "*** Running go-apidiff ***"
27-
28-
${APIDIFF} "${PULL_BASE_SHA}" --print-compatible
24+
APICHANGE=$(git --no-pager diff --name-only FETCH_HEAD | grep "api/")
25+
if [[ -n $APICHANGE ]]
26+
then
27+
APIDIFF_OLD_COMMIT="${PULL_BASE_SHA}" make apidiff
28+
fi

0 commit comments

Comments
 (0)