-
Notifications
You must be signed in to change notification settings - Fork 232
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Objective
Modify the gh-aw workflow compiler to generate grouped shell redirects instead of individual redirects, eliminating 164 shellcheck SC2129 style warnings across all compiled workflows.
Context
From discussion #15009 - Actionlint/shellcheck reports 164 occurrences of SC2129 across all 149 workflows (49% of all findings). This is a style issue in compiler-generated code.
Current Pattern (Generated):
echo "line 1" >> "$GH_AW_PROMPT"
echo "line 2" >> "$GH_AW_PROMPT"
echo "line 3" >> "$GH_AW_PROMPT"Desired Pattern:
{
echo "line 1"
echo "line 2"
echo "line 3"
} >> "$GH_AW_PROMPT"Approach
-
Locate the compiler code that generates shell scripts with redirects (likely in prompt construction or YAML generation phase)
- Check
pkg/workflow/compiler.goorpkg/workflow/compiler_yaml.go - Look for code generating multiple consecutive redirects to the same file/variable
- Check
-
Implement grouping logic:
- Detect sequences of commands redirecting to the same file
- Group them using brace syntax
{ ... } - Apply single redirect at the end
-
Handle edge cases:
- Single redirects (don't group)
- Mixed redirect types (
>vs>>) - Redirects to different files
- Preserve error handling behavior
-
Test the changes:
- Recompile several workflows with
make recompile - Verify generated
.lock.ymlfiles use grouped redirects - Run
gh aw compile --actionlintto confirm SC2129 warnings eliminated - Run
make test-unitto ensure tests pass - Test workflow execution to ensure behavior unchanged
- Recompile several workflows with
Files to Modify
pkg/workflow/compiler.goorpkg/workflow/compiler_yaml.go(compiler logic)- Potentially add helper functions for grouping redirects
- Update tests if needed
Acceptance Criteria
- Compiler generates grouped redirects for consecutive commands targeting same file
- All 164 SC2129 warnings eliminated (verify with actionlint)
- Edge cases handled correctly (single redirects, mixed types)
- Unit tests pass (
make test-unit) - Sample workflows recompile and execute correctly
- Generated code is cleaner and more performant
AI generated by Plan Command for discussion #15009
- expires on Feb 14, 2026, 1:28 AM UTC
Reactions are currently unavailable