Skip to content

Commit 5e20e13

Browse files
authored
ci: fix CI skip script hole (#21741)
In some environments, the script will not fail despite SKIP_CHECK_BRANCH being unset, leading to the script explicitly skipping CI when it should fail fast. Prevent this by explicitly checking for the env var.
1 parent 17d43c6 commit 5e20e13

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.github/scripts/check_skip_ci.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ set -euo pipefail
1313
#
1414
# ... `git merge-base origin/$SKIP_CHECK_BRANCH HEAD` would return commit `D`
1515
# `...HEAD` specifies from the common ancestor to the latest commit on the current branch (HEAD)..
16-
files_to_check=$(git diff --name-only "$(git merge-base origin/$SKIP_CHECK_BRANCH HEAD~)"...HEAD)
16+
skip_check_branch=${SKIP_CHECK_BRANCH:?SKIP_CHECK_BRANCH is required}
17+
files_to_check=$(git diff --name-only "$(git merge-base origin/$skip_check_branch HEAD~)"...HEAD)
1718

1819
# Define the directories to check
1920
skipped_directories=("docs/" "ui/" "website/" "grafana/" ".changelog/")
@@ -46,4 +47,4 @@ for file_to_check in "${files_to_check_array[@]}"; do
4647
done
4748

4849
echo "Changes detected in only documentation files - skipping tests and build"
49-
echo "skip-ci=true" >> "$GITHUB_OUTPUT"
50+
echo "skip-ci=true" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)