fix(release): strip refs/heads/ prefix from commit target - #38
Open
David Gamero (davidgamero) wants to merge 1 commit into
Open
fix(release): strip refs/heads/ prefix from commit target#38David Gamero (davidgamero) wants to merge 1 commit into
David Gamero (davidgamero) wants to merge 1 commit into
Conversation
create_release.yaml passed 'refs/heads/${{ inputs.branch }}' to
ncipollo/release-action's commit input, which expects a branch name or SHA,
not a fully qualified ref. When release.yaml passes github.ref
(refs/heads/main) this produced refs/heads/refs/heads/main, an invalid
target_commitish that release-action v1.20.0 rejects with a 422.
Normalize by stripping a leading refs/heads/ so callers may pass either a
full ref or a short branch name. Input passed via env to avoid injection.
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.
Complements #37.
What
create_release.yamlpassescommit: refs/heads/${{ inputs.branch }}toncipollo/release-action. That input expects a branch name or SHA, not a fully qualified ref. Whenrelease.yamlcalls it withbranch: ${{ github.ref }}(=refs/heads/main), the result isrefs/heads/refs/heads/main— an invalidtarget_commitishthat release-action v1.20.0 rejects with a 422 (seen in the v1.1.0 run).This normalizes the input in the reusable workflow by stripping a leading
refs/heads/, so callers may pass either a full ref or a short branch name.Backwards compatibility (all 3 callers)
branchincommitoutrelease.yamlrefs/heads/mainmainrelease_js_project.yamlreleases/vX.Y.Zreleases/vX.Y.Z(unchanged)nightly_release.yamlreleases/nightlyreleases/nightly(unchanged)Only the
refs/heads/…form is affected; short branch names pass through untouched. Input is passed viaenvto avoid shell injection.Relationship to #37
#37 fixes
release.yamlat the caller (github.ref→github.ref_name, plusv-prefixed tags). That's still needed and should land. This PR additionally hardens the sharedcreate_release.yamlso it never emits a malformed commitish for any caller — relevant because the JS repos consume it via the mutablev1tag. The two compose cleanly (this PR does not touchrelease.yaml).