Skip to content

Commit 4c277ac

Browse files
LuisHenriLee-W
authored andcommitted
feat(git): add get tag message function
1 parent 775bb30 commit 4c277ac

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

commitizen/git.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def from_line(cls, line: str, inner_delimiter: str) -> GitTag:
8383

8484

8585
def tag(
86-
tag: str, annotated: bool = False, signed: bool = False, msg: Optional[str] = None
86+
tag: str, annotated: bool = False, signed: bool = False, msg: str | None = None
8787
) -> cmd.Command:
8888
_opt = ""
8989
if annotated:
@@ -203,6 +203,13 @@ def get_latest_tag_name() -> str | None:
203203
return c.out.strip()
204204

205205

206+
def get_tag_message(tag: str) -> str | None:
207+
c = cmd.run(f"git tag -l --format='%(contents:subject)' {tag}")
208+
if c.err:
209+
return None
210+
return c.out.strip()
211+
212+
206213
def get_tag_names() -> list[str | None]:
207214
c = cmd.run("git tag --list")
208215
if c.err:

0 commit comments

Comments
 (0)