Document auto_tag behaviour more explicite (#37)
close #31 Co-authored-by: Lauris BH <lafriks@noreply.codeberg.org> Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/37 Reviewed-by: Lauris BH <lafriks@noreply.codeberg.org>
This commit is contained in:
@@ -123,7 +123,7 @@ func (p *Plugin) Validate() error {
|
||||
}
|
||||
|
||||
if p.settings.Build.TagsAuto {
|
||||
// return true if tag event or default branch
|
||||
// we only generate tags on default branch or an tag event
|
||||
if UseDefaultTag(
|
||||
p.settings.Build.Ref,
|
||||
p.settings.Build.Branch,
|
||||
|
||||
@@ -73,14 +73,10 @@ func DefaultTags(ref, defaultTag string) ([]string, error) {
|
||||
}
|
||||
|
||||
// UseDefaultTag for keep only default branch for latest tag
|
||||
// return true if tag event or default branch
|
||||
func UseDefaultTag(ref, defaultBranch string) bool {
|
||||
if strings.HasPrefix(ref, "refs/tags/") {
|
||||
return true
|
||||
}
|
||||
if stripHeadPrefix(ref) == defaultBranch {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return strings.HasPrefix(ref, "refs/tags/") ||
|
||||
stripHeadPrefix(ref) == defaultBranch
|
||||
}
|
||||
|
||||
func stripHeadPrefix(ref string) string {
|
||||
|
||||
Reference in New Issue
Block a user