bugfix: check if merge commit already has a tag before tagging
This commit is contained in:
@@ -25,11 +25,6 @@ def tag(target: str | None = None, token: str | None = None, update_changelog: b
|
|||||||
if target not in base.environments:
|
if target not in base.environments:
|
||||||
raise GitFlowError("Solo se pueden taggear commits en ramas principales.")
|
raise GitFlowError("Solo se pueden taggear commits en ramas principales.")
|
||||||
|
|
||||||
token, ci = get_token_and_ci(token)
|
|
||||||
|
|
||||||
if ci and not token:
|
|
||||||
raise GitFlowError("No hay token disponible")
|
|
||||||
|
|
||||||
merge_commit = Git(
|
merge_commit = Git(
|
||||||
"log", first_parent=True, merges=True, max_count=1, format="%H"
|
"log", first_parent=True, merges=True, max_count=1, format="%H"
|
||||||
).firstline()
|
).firstline()
|
||||||
@@ -37,6 +32,19 @@ def tag(target: str | None = None, token: str | None = None, update_changelog: b
|
|||||||
if not merge_commit:
|
if not merge_commit:
|
||||||
raise GitFlowError("No hay merges a taggear.")
|
raise GitFlowError("No hay merges a taggear.")
|
||||||
|
|
||||||
|
merge_commit_tag = Git("tag", "--points-at", merge_commit).firstline()
|
||||||
|
if merge_commit_tag:
|
||||||
|
base.io_info(f"El último merge ya tiene un tag: {merge_commit_tag}")
|
||||||
|
return
|
||||||
|
|
||||||
|
# Con varios entornos cada uno versiona por separado (v1.0.0-prod), con uno solo no hace falta
|
||||||
|
suffix = f"-{target}" if len(base.environments) > 1 else ""
|
||||||
|
|
||||||
|
token, ci = get_token_and_ci(token)
|
||||||
|
|
||||||
|
if ci and not token:
|
||||||
|
raise GitFlowError("No hay token disponible")
|
||||||
|
|
||||||
# Con varios entornos cada uno versiona por separado (v1.0.0-prod), con uno solo no hace falta
|
# Con varios entornos cada uno versiona por separado (v1.0.0-prod), con uno solo no hace falta
|
||||||
suffix = f"-{target}" if len(base.environments) > 1 else ""
|
suffix = f"-{target}" if len(base.environments) > 1 else ""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user