Skip to content

ops:triggering automation #14

ops:triggering automation

ops:triggering automation #14

Workflow file for this run

name: Detect Modified Folders
on:
push:
branches:
- fixes
jobs:
detect-modified-folders:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: fixes
fetch-depth: 0
# - name: Set up Git
# run: git fetch --depth=2 origin +refs/heads/*:refs/remotes/origin/*
- name: Find modified folders
id: find_modified_folders
run: |
# Define the base directory
BASE_DIR="apps"
ROOT=$(pwd)
# Get the list of modified files in the specified directory
if [ "$(git rev-list --count HEAD)" -eq 1 ]; then
git ls-files $BASE_DIR | sed -E 's|/[^/]+$||' | sort -u
MODIFIED_FOLDERS=()
else
MODIFIED_FOLDERS=($(git diff --name-only HEAD^ HEAD -- $BASE_DIR \
| sed -E 's|^(([^/]+/){1,2}).*|\1|; s|/$||' | sort -u))
fi
echo "Modified folders:"
echo "$MODIFIED_FOLDERS"
for pathvar in $MODIFIED_FOLDERS
do
echo "$pathvar"
done
# Save the list to an output variable
echo "folders=$MODIFIED_FOLDERS" >> GITHUB_OUTPUT