feature: tag from ci fetches commits from remote api

This commit is contained in:
Jonathan Teran Carballo
2026-09-20 21:05:21 -03:00
parent 889109bf77
commit 26ab81b175
8 changed files with 195 additions and 31 deletions
+25
View File
@@ -1,9 +1,20 @@
import subprocess
from dataclasses import dataclass
from git_flow import FLOWCONFIG_FILENAME
from git_flow.io import *
@dataclass
class Commit:
"""Datos de un commit necesarios para versionar y generar el changelog."""
sha: str
subject: str
email: str
is_merge: bool = False
class Git:
class Status:
worktree: str
@@ -65,6 +76,20 @@ class Git:
return Git("show", env_commits[-1] + "^", patch=False, format="%h").firstline()
@staticmethod
def get_commits(base: str, branch: str) -> list[Commit]:
"""Commits propios de la rama (sin merges), del más nuevo al más viejo."""
lines = Git(
"log", base + ".." + branch, first_parent=True, merges=False, format="%h%x09%ae%x09%s"
).lines()
commits = []
for line in lines:
[sha, email, subject] = line.split("\t", 2)
commits.append(Commit(sha, subject, email))
return commits
@staticmethod
def _get_references(kind: str):
prefix = "refs/" + kind