Backport of Disable docs change CI skip detection into release/1.16.x (#18778)

backport of commit 8af681d85b88388365b9bd7bbf7b4448663d0bb2

Co-authored-by: Michael Zalimeni <michael.zalimeni@hashicorp.com>
This commit is contained in:
hc-github-team-consul-core 2023-09-13 12:48:17 -05:00 committed by GitHub
parent f77e477ebe
commit a45294b7bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 20 deletions

View File

@ -8,26 +8,27 @@ skipped_directories=("docs/" "ui/" "website/" "grafana/")
# Initialize a variable to track directories outside the skipped ones # Initialize a variable to track directories outside the skipped ones
other_directories="" other_directories=""
trigger_ci=false trigger_ci=true
# Loop through the changed files and find directories/files outside the skipped ones # # Loop through the changed files and find directories/files outside the skipped ones
for file_to_check in $files_to_check; do # for file_to_check in $files_to_check; do
file_is_skipped=false # file_is_skipped=false
for dir in "${skipped_directories[@]}"; do # for dir in "${skipped_directories[@]}"; do
if [[ "$file_to_check" == "$dir"* ]] || [[ "$file_to_check" == *.md && "$dir" == *"/" ]]; then # if [[ "$file_to_check" == "$dir"* ]] || [[ "$file_to_check" == *.md && "$dir" == *"/" ]]; then
file_is_skipped=true # file_is_skipped=true
break # break
fi # fi
done # done
if [ "$file_is_skipped" = "false" ]; then # if [ "$file_is_skipped" = "false" ]; then
other_directories+="$(dirname "$file_to_check")\n" # other_directories+="$(dirname "$file_to_check")\n"
trigger_ci=true # trigger_ci=true
echo "Non doc file(s) changed - triggered ci: $trigger_ci" # echo "Non doc file(s) changed - triggered ci: $trigger_ci"
echo -e $other_directories # echo -e $other_directories
echo "trigger-ci=$trigger_ci" >>"$GITHUB_OUTPUT" # echo "trigger-ci=$trigger_ci" >>"$GITHUB_OUTPUT"
exit 0 ## if file is outside of the skipped_directory exit script # exit 0 ## if file is outside of the skipped_directory exit script
fi # fi
done # done
echo "Only doc file(s) changed - triggered ci: $trigger_ci" # echo "Only doc file(s) changed - triggered ci: $trigger_ci"
echo "Doc file(s) change detection is currently disabled - triggering ci"
echo "trigger-ci=$trigger_ci" >>"$GITHUB_OUTPUT" echo "trigger-ci=$trigger_ci" >>"$GITHUB_OUTPUT"