fix: emit custom changelog as a job-level reusable workflow call - #145
Merged
Merged
Conversation
A custom changelog workflow was emitted as a step inside the finalize job with uses: pointing at a reusable workflow path. GitHub Actions rejects that at parse time: a reusable workflow cannot be invoked as a step action, and the path lacked an @ref. The step also passed base_sha: needs.setup.outputs.base_sha, but the setup job declares changelog_base_sha, not base_sha, so that value was empty at runtime. Hoist the custom changelog into its own job that calls the reusable workflow via a normalized job-level uses:, depending on setup and passing changelog_base_sha/head_sha/repo keyed to the setup job's real outputs. The finalize job now lists changelog in its needs:, and the release step reads needs.changelog.outputs.changelog. The built-in changelog path is unchanged and stays a step. Adds an actionlint-backed unit test proving both hazards are gone and an e2e scenario exercising a custom changelog reusable workflow. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
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.
Problem
The custom changelog path (
changelog.workflow) was emitted as a step inside the finalize job:Two hazards:
uses:. GitHub Actions parses it as an action ref and rejects it (missing@ref); the path was also not normalized.base_sha: ${{ needs.setup.outputs.base_sha }}, but the setup job declareschangelog_base_sha, notbase_sha. That value was empty at runtime.Fix
Because a reusable workflow is invalid as a step
uses:, fixing 7a forces hoisting the custom changelog into its own job (the built-in changelog path is a real step and stays a step). The newchangelogjob:uses: ./.github/workflows/...setupand passeschangelog_base_sha/head_sha/repokeyed to the setup job's real outputs (fixes 7b)The finalize job now lists
changelogin itsneeds:, and the release step consumesneeds.changelog.outputs.changelogfor the custom case (steps.changelog.outputs.changelogfor built-in).Verification
TestGenerator_FinalizeJob_CustomChangelogassertions: job-leveluses:, normalized path,changelog_base_shakeyed to the real setup output, release readsneeds.changelog.outputs.changelog; asserts the old step name andbase_shareference are gone.TestCustomChangelog_Actionlint: runs actionlint over the generated workflow and reports no issues (proves 7a/7b are gone).18-custom-changelog.yamlexercises a custom changelog reusable workflow end to end.go build ./... && go test ./... && golangci-lint run ./...all green;go build/go vetgreen ine2e/.