From d29ac5de93d073646b482eb6e36019ba9b3a919e Mon Sep 17 00:00:00 2001 From: hc-github-team-consul-core Date: Tue, 17 Sep 2024 11:59:23 -0400 Subject: [PATCH] Backport of ci: fix CI skip script hole into release/1.3.x (#4326) backport of commit 5b045609a46bf6f486e2a36e5ddb750d9f76bdf3 Co-authored-by: Michael Zalimeni --- .github/scripts/check_skip_ci.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/scripts/check_skip_ci.sh b/.github/scripts/check_skip_ci.sh index b8785f5541..da05d7fefe 100755 --- a/.github/scripts/check_skip_ci.sh +++ b/.github/scripts/check_skip_ci.sh @@ -24,10 +24,11 @@ function contains() { # # ... `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=("assets" ".changelog/", "version") +skipped_directories=("assets" ".changelog" "version") files_to_skip=("LICENSE" ".copywrite.hcl" ".gitignore") @@ -43,7 +44,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 ]] || contains "${files_to_skip[*]}" "$file_to_check"; then file_is_skipped=true