Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/scripts/check_skip_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ set -euo pipefail
#
# ... `git merge-base origin/$SKIP_CHECK_BRANCH HEAD` would return commit `D`
# `...HEAD` specifies from the common ancestor to the latest commit on the current branch (HEAD)..
files_to_check=$(git diff --name-only "$(git merge-base origin/$SKIP_CHECK_BRANCH HEAD~)"...HEAD)
skip_check_branch=${SKIP_CHECK_BRANCH:?SKIP_CHECK_BRANCH is required}
files_to_check=$(git diff --name-only "$(git merge-base origin/$skip_check_branch HEAD~)"...HEAD)

# Define the directories to check
skipped_directories=("_doc/" ".changelog/")
skipped_directories=("_doc" ".changelog")

# Loop through the changed files and find directories/files outside the skipped ones
files_to_check_array=($files_to_check)
Expand All @@ -30,7 +31,7 @@ for file_to_check in "${files_to_check_array[@]}"; do
# - Markdown files
for dir in "${skipped_directories[@]}"; do
if [[ "$file_to_check" == */check_skip_ci.sh ]] ||
[[ "$file_to_check" == "$dir"* ]] ||
[[ "$file_to_check" == "$dir/"* ]] ||
[[ "$file_to_check" == *.md ]]; then
file_is_skipped=true
break
Expand All @@ -46,4 +47,4 @@ for file_to_check in "${files_to_check_array[@]}"; do
done

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