Skip to content

fix(generate): group consecutive >> redirects in generated shell (SC2129) - #704

Merged
reka18 merged 2 commits into
mainfrom
fix/generated-shell-sc2129-700
Dec 2, 2026
Merged

reka18 merged 2 commits into
mainfrom
fix/generated-shell-sc2129-700

Conversation

@reka18

@reka18 reka18 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

What was wrong

shellcheck flags SC2129 in the shell the orchestrate and promote generators emit: three or more separate >> redirects to the same file, such as $GITHUB_OUTPUT or $GITHUB_STEP_SUMMARY. CI never reported it because the workflow-lint and cli-install selftest lanes pass -e SC2129 to actionlint. (The first commit's message says CI's actionlint installs lack shellcheck. That's wrong: shellcheck is on the runners, and the exclusions are what hid it.)

What changed

  • Orchestrate's summary step: the header lines, callback rows and outputs header are consecutive writes to $GITHUB_STEP_SUMMARY. They now go out as one { ...; } >> "$GITHUB_STEP_SUMMARY" group, and the per-output table header gets its own group. The per-output rows and the no-outputs notice keep their single redirects.
  • Promote's release-data step: each branch's three $GITHUB_OUTPUT writes are grouped where they stand.
  • Only consecutive redirects to the same file are regrouped. The bytes written and the order of statements don't change.
  • The goldens and the dogfooded orchestrate.yaml and promote.yaml are regenerated. The two -e SC2129 exclusions are removed, so CI now enforces it. A shellcheck disable in env_gate_reusable_test.go is removed too, so that test now checks the grouped output.

One SC2129 site is left: the release_id / release_url / html_url writes in the manage-release composite action's inline script (internal/generate/actions.go). It belongs to the shared action emitter, not the two generators this issue covers, and no CI lint reads composite action scripts.

How it's tested

  • go test ./... with actionlint and shellcheck on PATH, so the actionlint feature-matrix and field-registry tests run instead of skipping. New tests pin the grouping, including the summary step with no outputs.
  • golangci-lint v2.10.1 on go1.26.11, and gofmt.
  • actionlint v1.7.12 with shellcheck and no exclusion: .github/workflows is clean, and the regenerated goldens have no SC2129 findings.
  • The e2e module builds and its harness tests pass. The scenarios run in CI.

Closes #700

…129)

shellcheck flags SC2129 in the shell the orchestrate and promote generators
emit: several separate >> redirects to the same file, for example
$GITHUB_OUTPUT and $GITHUB_STEP_SUMMARY. CI's actionlint never showed them
because its installs lack shellcheck, so the workflow-lint and cli-install
selftest lanes carried -e SC2129 exclusions to mask the generator style.

The orchestrate summary step's header lines, callback rows, and outputs
header are consecutive writes to $GITHUB_STEP_SUMMARY, so they now collapse
into one { ...; } >> group; the per-output table-header pair gets its own
group. The promote release-data step's three $GITHUB_OUTPUT writes group per
branch. Only consecutive redirects to the same file are regrouped: the
per-output rows and the no-outputs notice keep their single redirects, and
the written bytes and statement order are unchanged. The dogfooded
orchestrate.yaml and promote.yaml are regenerated onto the new style, the
byte-identical goldens are refreshed, and the two CI exclusions are dropped
so SC2129 is enforced. actionlint v1.7.12 with shellcheck now passes over
.github/workflows and the regenerated goldens with no exclusion.

Closes #700

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
Review of the #700 change found no defects in the grouping itself; this
commit closes the accuracy and coverage gaps it did find.

The env-gate actionlint test disabled shellcheck citing SC2129 nits in the
generated run bodies; those bodies now group their redirects, so the flag
is dropped and the test enforces the shellcheck cleanliness of the emitted
orchestrate and promote workflows wherever shellcheck is installed (the
hermeticity-motivated disable in runActionlint stays, with its stale
SC2129 wording removed). A new test pins the summary group's shape for a
manifest with no callbacks and no outputs, where folding the closing brace
into the outputs conditional would emit an unterminated { that no golden
covers.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
@reka18
reka18 merged commit 85864c4 into main Dec 2, 2026
21 checks passed
@reka18
reka18 deleted the fix/generated-shell-sc2129-700 branch December 2, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generated shell: group repeated >> redirects (shellcheck SC2129)

2 participants