osc-triggers/.builds/changed-paths.sh

32 lines
730 B
Bash
Raw Normal View History

2023-04-25 16:13:49 +01:00
#!/bin/bash
# Get the list of changed paths in the latest commit
changed_paths=$(git diff-tree --no-commit-id --name-only -r HEAD)
# Variables to track changes in specified paths
source_changed=false
website_changed=false
# Check if any of the specified paths have changed
for path in $changed_paths; do
if [[ $path == Cargo.* || $path == src/* || $path == .build/* ]]; then
source_changed=true
elif [[ $path == website/* ]]; then
website_changed=true
fi
done
# Determine the result based on the changes detected
if $source_changed && $website_changed; then
result="all"
elif $source_changed; then
result="source"
elif $website_changed; then
result="website"
else
result="none"
fi
2023-04-25 16:16:17 +01:00
echo "$result"
2023-04-25 16:13:49 +01:00
exit 0