Skip to content

fix: normalize hyphenated change-detection output keys to underscores - #135

Merged
joshua-temple merged 2 commits into
mainfrom
fix/hyphenated-name-output-keys
Jun 13, 2026
Merged

joshua-temple merged 2 commits into
mainfrom
fix/hyphenated-name-output-keys

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

Generated change-detection identifiers (run_build_<name>, run_deploy_<name>, and the sibling base_build_<name>/base_deploy_<name> SHA passthroughs) were emitted with the raw callback name at the setter and job-output passthrough sites, but the underscore-normalized form (config.OutputKey) at the consuming if: condition.

For a hyphenated name like shared-lib, the setup job exposed run_build_shared-lib, while the consuming job checked needs.setup.outputs.run_build_shared_lib. GitHub Actions parses the hyphen in an expression as subtraction (shared minus lib), so the reference never resolved and the consuming job's if: was always false. The build/deploy was silently skipped with no error.

Fix

Route every emission and reference site through config.OutputKey so the identifier is underscore-normalized consistently:

  • internal/output/output.go - the runtime setter that writes run_build_*, run_deploy_*, and base_* to $GITHUB_OUTPUT.
  • internal/generate/generator.go - the setup job-level outputs: passthrough for run_build_*/run_deploy_* and base_build_*/base_deploy_*.

The consuming if: condition already used config.OutputKey, so it now matches.

This is a no-op for names without a hyphen (OutputKey only replaces - with _). Human-facing job IDs and display names keep their hyphens; only the output-key identifiers change.

Verification

  • New regression test TestGenerator_HyphenatedNameOutputKeysConsistent (hyphenated shared-lib build and web-api deploy) asserts the passthrough, the setter reference, and the consuming if: all use the same underscore key, and that no hyphenated run_*/base_* identifier appears. Confirmed failing before the fix, passing after.
  • go build ./..., go test ./..., and golangci-lint run all pass.
  • actionlint on a generated hyphenated sample reports no expression errors.

Closes #127

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple merged commit 2a11262 into main Jun 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generator: hyphenated build/deploy names produce a mismatched skip-condition (always-false if:)

1 participant