Skip to content

Commit 855d41b

Browse files
committed
[ci] Fix docs-go scope guard to diff against the PR base branch
The docs-go scope guard computed its diff base as the merge-base with a hardcoded origin/master. On a release-branch backport (base releases/X.Y), that merge-base is where the release branch diverged from master, so the diff includes every change that landed on the release branch but not master. A genuinely content-only doc backport is then flagged with the release branch's non-doc changes and the guard fails a valid PR. Diff against ${BUILDKITE_PULL_REQUEST_BASE_BRANCH:-master} instead, matching ci/lint/lint.sh and ci/pipeline/determine_tests_to_run.py. On a normal PR the base is master and behavior is unchanged; on a backport it correctly scopes to the files the PR actually adds. Signed-off-by: Douglas Strodtman <douglas@anyscale.com>
1 parent 7a5d7f1 commit 855d41b

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

ci/lint/validate_docs_go_scope.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,18 @@
4646

4747
set -uo pipefail
4848

49-
git fetch --depth=500 origin master >/dev/null 2>&1 || true
50-
if ! base="$(git merge-base origin/master HEAD 2>/dev/null)"; then
51-
echo "docs-go scope guard: could not determine merge-base with origin/master; failing closed."
49+
# Diff against the PR's actual base branch, not a hardcoded master. On a
50+
# release-branch backport the merge-base with master is where the release
51+
# branch diverged, so diffing against master attributes every release-only
52+
# change to the PR and the guard fails a genuinely content-only backport.
53+
# BUILDKITE_PULL_REQUEST_BASE_BRANCH is the base the PR targets; fall back to
54+
# master for local runs, matching ci/lint/lint.sh and
55+
# ci/pipeline/determine_tests_to_run.py.
56+
base_branch="${BUILDKITE_PULL_REQUEST_BASE_BRANCH:-master}"
57+
58+
git fetch --depth=500 origin "${base_branch}" >/dev/null 2>&1 || true
59+
if ! base="$(git merge-base "origin/${base_branch}" HEAD 2>/dev/null)"; then
60+
echo "docs-go scope guard: could not determine merge-base with origin/${base_branch}; failing closed."
5261
exit 1
5362
fi
5463

0 commit comments

Comments
 (0)