fix: docker build include valid string prior to sha #4613
Merged
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.
I noticed failing docker builds when the trigger is a tag
https://github.com/block/goose/actions/runs/17649096320/job/50154994435?pr=4577
Issue
The problematic line of the action config was:
type=sha,prefix={{branch}}-When this action runs on a tag (like
v1.8.0), the{{branch}}variable is empty, resulting in a tag that starts with just a hyphen:ghcr.io/block/goose:-881a71a. This is an invalid Docker tag format.Solution
Updated the workflow to use a fixed prefix:
type=sha,prefix=sha-This change ensures that SHA-based tags will always have a valid format like
ghcr.io/block/goose:sha-881a71aregardless of whether the workflow is triggered by a branch push or a tag