You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[plan] Fix SC2012: Replace ls with find in 41 workflows #7898
Fix 72 occurrences of shellcheck SC2012 info-level issues across 41 workflows by replacing ls parsing with find commands for more robust filename handling.
Problem
Using ls output in scripts can fail with special characters in filenames (spaces, newlines, etc.):
ls -t *.yml | head -5 # ❌ Breaks with spaces/special chars
Solution
Use find with proper formatting:
find . -name "*.yml" -type f -printf '%T@ %p\n'| sort -rn | head -5 | cut -d'' -f2
Impact
While info-level, this improves robustness when:
Filenames contain spaces or special characters
Operating in directories with varied file naming conventions
Processing user-generated or external files
Approach
Identify all ls usage patterns in workflow .md files
Determine the intent of each ls command (sorting, filtering, etc.)
Replace with equivalent find commands
Test locally if possible for common patterns
Recompile workflows: make recompile
Verify with actionlint
Common Patterns to Fix
# Pattern 1: List by time
ls -t pattern | head -n → find + sort + head
# Pattern 2: List all files
ls pattern → find -name pattern
# Pattern 3: List with size
ls -lh pattern → find -printf with custom format
Files to Modify
41 workflow .md files in .github/workflows/ (72 total occurrences)
Activity