Skip to content

Commit a64d73f

Browse files
authored
Enhance the doc only change detection logic to skip the pipeline (#197)
Signed-off-by: Huamin Li <[email protected]>
1 parent 65cd0ae commit a64d73f

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

buildkite/bootstrap.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,27 +114,30 @@ fi
114114
# Early exit start: skip pipeline if conditions are met
115115
# ----------------------------------------------------------------------
116116

117-
# skip pipeline if all changed files are under docs/
117+
# skip pipeline if *every* changed file is docs/** OR **/*.md OR mkdocs.yaml
118118
if [[ "${DOCS_ONLY_DISABLE}" != "1" ]]; then
119119
if [[ -n "${file_diff:-}" ]]; then
120120
docs_only=1
121-
# Robust iteration over newline-separated file_diff
121+
# Iterate robustly over newline-separated paths
122122
while IFS= read -r f; do
123123
[[ -z "$f" ]] && continue
124-
# **Policy:** only skip if *every* path starts with docs/
125-
if [[ "$f" != docs/* ]]; then
124+
# Match any of: docs/** OR **/*.md OR mkdocs.yaml
125+
# Using prefix check for docs/ so nested paths match (no need for globstar).
126+
if [[ "${f#docs/}" != "$f" || "$f" == *.md || "$f" == "mkdocs.yaml" ]]; then
127+
continue
128+
else
126129
docs_only=0
127130
break
128131
fi
129132
done < <(printf '%s\n' "$file_diff" | tr ' ' '\n' | tr -d '\r')
130133

131134
if [[ "$docs_only" -eq 1 ]]; then
132-
buildkite-agent annotate ":memo: CI skipped — docs/** only changes detected
135+
buildkite-agent annotate ":memo: CI skipped — docs/Markdown/mkdocs-only changes detected
133136
134137
\`\`\`
135-
${file_diff}
138+
$(printf '%s\n' "$file_diff" | tr ' ' '\n')
136139
\`\`\`" --style "info" || true
137-
echo "[docs-only] All changes are under docs/. Exiting before pipeline upload."
140+
echo "[docs-only] All changes are docs/**, *.md, or mkdocs.yaml. Exiting before pipeline upload."
138141
exit 0
139142
fi
140143
fi

0 commit comments

Comments
 (0)