-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport of NET-5382 & PLAT-1159: Do not trigger workflow if only doc…
… files are in commit history into release/1.16.x (#18570) backport of commit c833fcc Co-authored-by: NiniOak <[email protected]>
- Loading branch information
1 parent
7c72bba
commit 58ec03b
Showing
3 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
# Get the list of changed files | ||
files_to_check=$(git diff --name-only origin/$GITHUB_BASE_REF) | ||
|
||
# Define the directories to check | ||
skipped_directories=("docs/" "ui/" "website/" "grafana/") | ||
|
||
# Initialize a variable to track directories outside the skipped ones | ||
other_directories="" | ||
trigger_ci=false | ||
|
||
# Loop through the changed files and find directories/files outside the skipped ones | ||
for file_to_check in $files_to_check; do | ||
file_is_skipped=false | ||
for dir in "${skipped_directories[@]}"; do | ||
if [[ "$file_to_check" == "$dir"* ]] || [[ "$file_to_check" == *.md && "$dir" == *"/" ]]; then | ||
file_is_skipped=true | ||
break | ||
fi | ||
done | ||
if [ "$file_is_skipped" = "false" ]; then | ||
other_directories+="$(dirname "$file_to_check")\n" | ||
trigger_ci=true | ||
echo "Non doc file(s) changed - triggered ci: $trigger_ci" | ||
echo -e $other_directories | ||
echo "trigger-ci=$trigger_ci" >>"$GITHUB_OUTPUT" | ||
exit 0 ## if file is outside of the skipped_directory exit script | ||
fi | ||
done | ||
|
||
echo "Only doc file(s) changed - triggered ci: $trigger_ci" | ||
echo "trigger-ci=$trigger_ci" >>"$GITHUB_OUTPUT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters