Fix SC2129 shellcheck errors: use brace group redirects#572
Open
Fix SC2129 shellcheck errors: use brace group redirects#572
Conversation
Replace multiple individual redirects (>> file) with brace group redirects
({ cmd1; cmd2; } >> file) to improve code quality and follow shellcheck
best practices.
Changes:
- Converted all instances of multiple echo >> $GITHUB_ENV to brace groups
- Removed SC2129 from actionlint ignore list in pr-build.yml
Files modified:
- .github/workflows/pr-build.yml (removed SC2129 from ignore list)
- .github/workflows/dotnet-ec2-adot-sigv4-test.yml (line 144-147)
- .github/workflows/dotnet-ec2-asg-test.yml (line 193-197)
- .github/workflows/dotnet-ec2-default-test.yml (line 183-186)
- .github/workflows/dotnet-ec2-nuget-test.yml (line 165-168)
- .github/workflows/dotnet-ec2-windows-test.yml (line 182-186)
- .github/workflows/java-ec2-adaptive-sampling-test.yml (line 135-139)
- .github/workflows/java-ec2-adot-sigv4-test.yml (line 166-169)
- .github/workflows/java-ec2-asg-test.yml (line 213-217)
- .github/workflows/java-ec2-default-test.yml (line 204-207)
- .github/workflows/java-ec2-ubuntu-test.yml (line 176-179)
- .github/workflows/node-ec2-adot-sigv4-test.yml (line 159-162)
- .github/workflows/node-ec2-asg-test.yml (line 196-200)
- .github/workflows/node-ec2-default-test.yml (line 197-200)
- .github/workflows/python-ec2-adaptive-sampling-test.yml (line 142-146)
- .github/workflows/python-ec2-asg-test.yml (line 216-220)
- .github/workflows/python-ec2-default-test.yml (line 206-209)
- .github/workflows/python-ec2-genesis-test.yml (line 71-79)
Testing: Comprehensive behavioral tests confirm identical functionality.
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.
Summary
This PR fixes all SC2129 shellcheck warnings by replacing multiple individual redirects with brace group redirects, following shellcheck best practices.
What Changed
Before (SC2129 violation):
After (SC2129 compliant):
{ echo "VAR1=value1" echo "VAR2=value2" echo "VAR3=value3" } >> $GITHUB_ENVFiles Modified
Configuration:
.github/workflows/pr-build.yml: Removed SC2129 from ignore list and commentWorkflow Files (17 files):
.github/workflows/dotnet-ec2-adot-sigv4-test.yml(line 144-147).github/workflows/dotnet-ec2-asg-test.yml(line 193-197).github/workflows/dotnet-ec2-default-test.yml(line 183-186).github/workflows/dotnet-ec2-nuget-test.yml(line 165-168).github/workflows/dotnet-ec2-windows-test.yml(line 182-186).github/workflows/java-ec2-adaptive-sampling-test.yml(line 135-139).github/workflows/java-ec2-adot-sigv4-test.yml(line 166-169).github/workflows/java-ec2-asg-test.yml(line 213-217).github/workflows/java-ec2-default-test.yml(line 204-207).github/workflows/java-ec2-ubuntu-test.yml(line 176-179).github/workflows/node-ec2-adot-sigv4-test.yml(line 159-162).github/workflows/node-ec2-asg-test.yml(line 196-200).github/workflows/node-ec2-default-test.yml(line 197-200).github/workflows/python-ec2-adaptive-sampling-test.yml(line 142-146).github/workflows/python-ec2-asg-test.yml(line 216-220).github/workflows/python-ec2-default-test.yml(line 206-209).github/workflows/python-ec2-genesis-test.yml(line 71-79)Why This Change is Safe
This is a code quality improvement with no functional impact:
Testing
Actionlint Validation
Command used:
actionlint -color -ignore SC2086 -ignore SC2004 -ignore SC2016 -ignore SC2010 -ignore SC2015 -ignore SC2260 -ignore SC2046 -ignore SC2181 .github/workflows/*.ymlResult: ✅ Exit code 0 (all SC2129 errors resolved)
Behavioral Tests
All tests passed confirming identical behavior:
Test 1: Basic multiple redirects
Test 2: Command substitution
terraform output)Test 3: Mixed variables and command substitution
Test 4: Exit code preservation on success
Test 5: File creation behavior
Test 6: Append to existing file
What Each Test Validates
$(terraform output ...)patterns used in workflows$varpatterns used in workflowsImpact Assessment
Category: Code Quality Improvement
Risk Level: Minimal
Benefits:
Additional Notes