cmg-ws2024525-demo/changed-directories.sh

9 lines
284 B
Bash

#!/bin/bash
# Find changes between the latest commit and main
CHANGED_FILES=$(git diff --name-only origin/main..HEAD)
# Extract directories under 'services' that were changed
CHANGED_DIRS=$(echo "$CHANGED_FILES" | grep '^services/' | cut -d'/' -f2 | sort | uniq)
echo $CHANGED_DIRS