-
Notifications
You must be signed in to change notification settings - Fork 224
Closed
Labels
Description
Objective
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 charsSolution
Use find with proper formatting:
find . -name "*.yml" -type f -printf '%T@ %p\n' | sort -rn | head -5 | cut -d' ' -f2Impact
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
lsusage patterns in workflow.mdfiles - Determine the intent of each
lscommand (sorting, filtering, etc.) - Replace with equivalent
findcommands - 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 formatFiles to Modify
41 workflow .md files in .github/workflows/ (72 total occurrences)
Acceptance Criteria
- All 72 SC2012 issues resolved
- Equivalent functionality preserved
-
actionlintshows 0 SC2012 issues - Workflows compile successfully
Related to [plan] Address static analysis findings from actionlint/shellcheck #7896
AI generated by Plan Command for discussion #7889
Reactions are currently unavailable