add filtering to the workflows
This commit is contained in:
parent
2be324f75e
commit
59af636961
@ -26,7 +26,7 @@ jobs:
|
||||
nc -h
|
||||
echo "=== Debug: Setup complete ==="
|
||||
|
||||
- name: Find deleted source files
|
||||
- name: Find deleted source files (deleted only)
|
||||
id: deleted
|
||||
run: |
|
||||
echo "=== Debug: Starting deletion detection ==="
|
||||
@ -35,6 +35,7 @@ jobs:
|
||||
# Check if we have a parent commit
|
||||
if git rev-parse --verify HEAD~1 >/dev/null 2>&1; then
|
||||
echo "Parent commit exists; checking for deletions."
|
||||
# Use --diff-filter=D to only get Deleted files (exclude Added/Modified)
|
||||
DELETED_FILES=$(git diff --name-only --diff-filter=D HEAD~1 2>/dev/null | grep -E '\.(c|bas)$')
|
||||
echo "Deleted files from last commit: '${DELETED_FILES}'"
|
||||
else
|
||||
|
||||
@ -31,7 +31,7 @@ jobs:
|
||||
nc -h
|
||||
echo "=== Debug: Setup complete ==="
|
||||
|
||||
- name: Find changed source files
|
||||
- name: Find changed source files (added/modified only)
|
||||
id: files
|
||||
run: |
|
||||
echo "=== Debug: Starting file detection ==="
|
||||
@ -39,9 +39,10 @@ jobs:
|
||||
echo "Files in repo: $(ls -la)"
|
||||
echo "=== Debug: Checking for parent commit ==="
|
||||
if git rev-parse --verify HEAD~1 >/dev/null 2>&1; then
|
||||
echo "Parent commit exists; running git diff."
|
||||
CHANGED_FILES=$(git diff --name-only HEAD~1 2>/dev/null | grep -E '\.(c|bas)$' | head -1)
|
||||
echo "Changed files from last commit: '${CHANGED_FILES}'"
|
||||
echo "Parent commit exists; running git diff for added/modified files only."
|
||||
# Use --diff-filter=AM to only get Added and Modified files (exclude Deleted)
|
||||
CHANGED_FILES=$(git diff --name-only --diff-filter=AM HEAD~1 2>/dev/null | grep -E '\.(c|bas)$' | head -1)
|
||||
echo "Added/Modified files from last commit: '${CHANGED_FILES}'"
|
||||
else
|
||||
echo "No parent commit; skipping diff."
|
||||
CHANGED_FILES=""
|
||||
@ -50,7 +51,7 @@ jobs:
|
||||
|
||||
# Fallback to all .c/.bas files if no changes or no previous commit
|
||||
if [ -z "$CHANGED_FILES" ]; then
|
||||
echo "=== Debug: No changes found; running fallback find ==="
|
||||
echo "=== Debug: No added/modified files found; running fallback find ==="
|
||||
# Find newest .c/.bas by modification time (sort -nr on %T@ timestamp)
|
||||
CHANGED_FILES=$(find . -type f \( -name "*.c" -o -name "*.bas" \) -printf '%T@ %p\n' 2>/dev/null | sort -nr | cut -d' ' -f2- | head -1)
|
||||
echo "Fallback files (newest first): '${CHANGED_FILES}'"
|
||||
@ -58,7 +59,7 @@ jobs:
|
||||
fi
|
||||
|
||||
if [ -z "$CHANGED_FILES" ]; then
|
||||
echo "No C/BAS files found; skipping workflow."
|
||||
echo "No added/modified C/BAS files found; skipping workflow."
|
||||
exit 0 # Graceful skip, no failure
|
||||
fi
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user