Skip to content

[Code Quality] Fix SC2129 shellcheck warnings - group consecutive redirects #14592

@github-actions

Description

@github-actions

Description

Static analysis identified 164 instances of SC2129 shellcheck warnings across workflow files. This style issue occurs when multiple consecutive commands redirect to the same file individually, rather than grouping them with { cmd1; cmd2; } >> file pattern.

While this is a style issue (not a security vulnerability), fixing it improves code quality and reduces shellcheck noise.

Current Pattern

echo "key1=value1" >> $GITHUB_OUTPUT
echo "key2=value2" >> $GITHUB_OUTPUT
echo "key3=value3" >> $GITHUB_OUTPUT

Recommended Pattern

{
  echo "key1=value1"
  echo "key2=value2"
  echo "key3=value3"
} >> $GITHUB_OUTPUT

Scope

  • Total instances: 164 across 148 workflow files
  • Pattern: Consecutive redirects to $GITHUB_OUTPUT, $GITHUB_STEP_SUMMARY, $GITHUB_ENV
  • Files affected: .github/workflows/*.md source files (not .lock.yml files)

Suggested Changes

  1. Identify affected workflows: Use grep to find all instances:

    grep -r ">> \$GITHUB_OUTPUT" .github/workflows/*.md
    grep -r ">> \$GITHUB_STEP_SUMMARY" .github/workflows/*.md
  2. Fix pattern: Group consecutive redirects to same file

    • Look for 2+ consecutive echo/printf statements to same file
    • Wrap them in { ...; } >> file block
  3. Recompile workflows: Run make recompile to regenerate .lock.yml files

  4. Validate: Run make lint to ensure shellcheck warnings are resolved

Files Affected

Multiple workflow files in .github/workflows/ (estimated 50-60 files based on 164 instances)

Examples from previous fixes:

  • .github/workflows/hourly-ci-cleaner.md (lines 72-77)
  • .github/workflows/smoke-copilot.md (lines 84-89)

Success Criteria

  • All SC2129 shellcheck warnings resolved (164 → 0)
  • Workflows recompiled with make recompile
  • make lint passes without SC2129 warnings
  • No functional changes to workflow behavior

Automation Opportunity

Consider creating a script to automatically detect and fix this pattern:

# Detect pattern: 2+ consecutive lines with same redirect
# Transform: wrap in { ...; } >> file block
# Apply: to all .md files in .github/workflows/

Source

Extracted from Static Analysis Report - February 8, 2026 (Discussion #14568)

Priority

Low - Style improvement, not blocking, but reduces linting noise significantly

Estimated Effort

  • Manual fix: 2-3 days to review and fix 164 instances
  • Automated fix: 1 day to create script + validation

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 10, 2026, 5:27 AM UTC

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions