Consolidate consecutive shell redirects to fix SC2129 warnings#9153
Merged
Consolidate consecutive shell redirects to fix SC2129 warnings#9153
Conversation
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix ShellCheck warnings by consolidating redirects
Consolidate consecutive shell redirects to fix SC2129 warnings
Jan 6, 2026
This was referenced Jan 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shellcheck SC2129 warns about inefficient consecutive redirects to the same file. Each
>>operation opens/closes the file separately; grouped redirects open once, write all, close once.Changes
pkg/workflow/mcp_servers.go
$GITHUB_OUTPUTinto single grouped commandgithub/workflows/daily-choice-test.md
$GITHUB_STEP_SUMMARYinto single grouped commandPattern
Before:
After:
{ echo "safe_inputs_api_key=${API_KEY}" echo "safe_inputs_port=${PORT}" } >> "$GITHUB_OUTPUT"Eliminates all SC2129 warnings across 125 workflows (verified with shellcheck).
Original prompt
This section details on the original issue you should resolve
<issue_title>[plan] Apply shellcheck improvements (SC2129 redirects)</issue_title>
<issue_description>## Objective
Fix 7 shellcheck warnings (SC2129) across 3 workflows by consolidating multiple redirect operations into grouped commands for better performance and code clarity.
Context
ShellCheck Rule SC2129: "Consider using
{ cmd1; cmd2; } >> fileinstead of individual redirects"Why it matters:
Impact Level: Low - These are style/performance improvements, not breaking errors.
Affected Workflows
Current Pattern (Inefficient)
Each
>>operation:output.txtImproved Pattern (Efficient)
Single operation:
output.txtonceFix Examples
Example 1: Simple echo statements
Before:
After:
{ echo "Status: success" echo "Time: $(date)" echo "Files processed: $count" } >> report.txtExample 2: Mixed commands
Before:
After:
{ echo "=== Results ===" cat results.json echo "=== End ===" } >> log.txtExample 3: With variables
Before:
After:
{ echo "STEP_OUTPUT=$output" echo "STEP_STATUS=$status" echo "STEP_TIME=$time" } >> $GITHUB_ENVFiles to Modify
Markdown source files (fix these, then recompile):
.github/workflows/beads-worker.md.github/workflows/smoke-copilot-no-firewall.md.github/workflows/daily-choice-test.mdValidation Steps
>> same_file{ ... }group with single redirectmake recompileshellcheck -x .github/workflows/{workflow}.lock.ymlor via actionlintAcceptance Criteria
{ ... }syntaxTesting
Performance Impact
For files with many redirects, the improvement can be measurable:
Additional Improvements
While fixing SC2129, also look for:
References
specs/github-actions-security-best-practices.mdRelated to [plan] Fix static analysis findings from January 2026 scan #9122
Comments on the Issue (you are @copilot in this section)
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.