fix: normalize local callback workflow paths to .github/workflows - #140
Merged
Merged
Conversation
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
normalizeWorkflowPathonly prepended./when a callback workflow path already started with.github/. A callbackworkflow:that was a bare filename (build.yaml) was emitted verbatim asuses: build.yaml, which GitHub rejects at parse:Nearly every shipped
e2e/scenarios/*.yamluses bare callback paths, so the act/gitea harness had been tolerating invalid YAML that real GitHub would reject. Confirmed with actionlint 1.7.12.Fix
GitHub requires local reusable workflows to live in
.github/workflows/.normalizeWorkflowPathnow routes every local callback to the valid./.github/workflows/<file>form:@, e.g.owner/repo/.github/workflows/x.yml@ref): unchanged../.github/workflows/...: unchanged..github/workflows/x.yaml: gets the./prefix.build.yaml) or any other local path: routed to./.github/workflows/<basename>.A non-
.github/workflowslocal subdir path (e.g.ci/build.yaml) is not a valid local reusable-workflow location, so it is now rejected at config validation with:wired into the build, deploy, and validate callback validation in
internal/config/parse.go. All build/deploy/publish local callbackuses:emission sites already route throughnormalizeWorkflowPath(generator.go:863, generator.go:1323, promote.go:798/846/895/1060/1312, hotfix.go:405). The custom-changelog callback is a separate structural issue and is out of scope here.Scenario / harness lockstep
The fix changes generated output (
uses: ./.github/workflows/build.yaml), so the e2e harness now places each callback stub at the matching normalized path. AnormalizeCallbackStubPathhelper ine2e/harness/harness.gomirrors the generator rule (skip@external refs; else.github/workflows/+ basename) so the stub lands where the generateduses:points and the.github/workflows/*.yamlgit-add glob picks it up. No scenario YAML changes were needed: all scenarios use bare filenames, which are valid input and normalize correctly.The eight
cascade-example-*repos should be regenerated with the fixed generator when that work resumes; they are separate repos and out of scope here.Verification
go build ./..., fullgo test ./...(1202 tests) pass.golangci-lint run ./internal/generate/... ./internal/config/...clean.go build ./... && go vet ./...clean.uses: ./.github/workflows/build.yamlwith noworkflow-callformat error./versionand/infoand did not recover after a Docker Desktop restart. The harness/scenario reconciliation is covered by the unit and actionlint tests and the matched stub-placement path; the Docker e2e scenario should be run once the daemon is healthy.Closes #139