Skip to content

Commit e5fc760

Browse files
committed
feat: add pattern match validation and improve CI tests
Improvements: - Warn when exclude patterns don't match any repositories - Shows which patterns are ineffective (helps catch typos/wrong regex) - Tracks excluded repository count in output - Simplified warning message (one line per unmatched pattern) CI Enhancements: - Verify weekly-report.md file is created - Show file size and list directory on failure - Better debugging output for test failures Example output: Exclude patterns (2 total): - Pattern: 'lecture-\.notebooks' - Pattern: 'test-.*' ✗ Excluding: test-translation-sync (matched 'test-.*') ⚠️ Warning: Pattern 'lecture-\.notebooks' didn't match any repositories Repositories after filtering: 25 (excluded: 1) Helps users catch pattern mistakes like: - Missing '.*' for multi-char matching - Wrong escaping - Typos in pattern
1 parent 86125e6 commit e5fc760

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,18 @@ jobs:
6262
echo "ERROR: No report content generated"
6363
exit 1
6464
fi
65+
66+
# Check that weekly-report.md was created
67+
if [ ! -f "weekly-report.md" ]; then
68+
echo "ERROR: weekly-report.md file not found"
69+
echo "Files in current directory:"
70+
ls -la
71+
exit 1
72+
fi
73+
6574
echo "SUCCESS: Report generated"
6675
echo "Summary: ${{ steps.test-report.outputs.report-summary }}"
76+
echo "Report file size: $(wc -l weekly-report.md) lines"
6777
6878
- name: Test JSON output format
6979
uses: ./

generate-report.sh

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,11 @@ if [ -n "$EXCLUDE_REPOS" ]; then
351351
echo " - Pattern: '$pattern'"
352352
done
353353
354+
# Track matches for each pattern (simple counter approach)
355+
pattern_match_counts=""
356+
354357
filtered_repos=""
358+
excluded_count=0
355359
while IFS= read -r repo; do
356360
[ -z "$repo" ] && continue
357361
excluded=false
@@ -361,6 +365,17 @@ if [ -n "$EXCLUDE_REPOS" ]; then
361365
# Check if pattern matches using grep -E (extended regex)
362366
if echo "$repo" | grep -qE "^${exclude_pattern}$"; then
363367
excluded=true
368+
excluded_count=$((excluded_count + 1))
369+
# Track this match
370+
if echo "$pattern_match_counts" | grep -q "^${exclude_pattern}:"; then
371+
# Increment count
372+
old_count=$(echo "$pattern_match_counts" | grep "^${exclude_pattern}:" | cut -d: -f2)
373+
new_count=$((old_count + 1))
374+
pattern_match_counts=$(echo "$pattern_match_counts" | sed "s/^${exclude_pattern}:${old_count}$/${exclude_pattern}:${new_count}/")
375+
else
376+
# First match for this pattern
377+
pattern_match_counts="${pattern_match_counts}${exclude_pattern}:1"$'\n'
378+
fi
364379
echo " ✗ Excluding: $repo (matched '$exclude_pattern')"
365380
break
366381
fi
@@ -373,8 +388,18 @@ if [ -n "$EXCLUDE_REPOS" ]; then
373388
fi
374389
fi
375390
done <<< "$repo_names"
391+
392+
# Warn about patterns that didn't match anything
393+
echo ""
394+
for pattern in "${exclude_array[@]}"; do
395+
pattern=$(echo "$pattern" | xargs)
396+
if ! echo "$pattern_match_counts" | grep -q "^${pattern}:"; then
397+
echo " ⚠️ Warning: Pattern '$pattern' didn't match any repositories"
398+
fi
399+
done
400+
376401
repo_names="$filtered_repos"
377-
echo "Repositories after filtering: $(echo "$repo_names" | wc -l | xargs)"
402+
echo "Repositories after filtering: $(echo "$repo_names" | wc -l | xargs) (excluded: $excluded_count)"
378403
fi
379404
380405
# Initialize report variables

0 commit comments

Comments
 (0)