Merged in docs/change-changelog-format (pull request #10)

docs: change changelog format

Approved-by: Jonathan Teran
This commit is contained in:
JonathanGitFlow
2025-11-02 17:00:37 +00:00
committed by jt
3 changed files with 70 additions and 14 deletions
+47
View File
@@ -1,3 +1,50 @@
## Domingo, 2 de Noviembre de 2025, 14:00
- Autor: [Jonathan Teran Carballo](mailto:jonathan.nerat@gmail.com)
- Rama: `docs/change-changelog-format`
### Commits
- **bugfix**: arreglo concatenacion de lineas de changelog (8f30dc6)
- git-flow (M)
- **docs**: agrego link a respuesta de PR creado (2bf8dbc)
- git-flow (M)
- **docs**: cambio descripcion de PR para que solo contenga los commits (1de6a64)
- git-flow (M)
- lib/io.py (M)
- **docs**: cambio header de changelog, arreglo generacion de descripcion de Prs (eba73fe)
- git-flow (M)
---
- **docs**: agrego link a respuesta de PR creado (2bf8dbc)
- git-flow (M)
- **docs**: cambio descripcion de PR para que solo contenga los commits (1de6a64)
- git-flow (M)
- lib/io.py (M)
- **docs**: cambio header de changelog, arreglo generacion de descripcion de Prs (eba73fe)
- git-flow (M)
---
- **docs**: cambio descripcion de PR para que solo contenga los commits (1de6a64)
- git-flow (M)
- lib/io.py (M)
- **docs**: cambio header de changelog, arreglo generacion de descripcion de Prs (eba73fe)
- git-flow (M)
---
## Domingo, 2 de Noviembre de 2025, 13:47
- Autor: [Jonathan Teran Carballo](mailto:jonathan.nerat@gmail.com)
- Rama: `docs/change-changelog-format`
### Commits
- **docs**: cambio header de changelog, arreglo generacion de descripcion de Prs (eba73fe)
- git-flow (M)
---
## Domingo, 2 de Noviembre de 2025, 13:40
### Autor
+20 -14
View File
@@ -479,7 +479,7 @@ def update_changelog(branch: str, target: str):
return True
def generate_changelog_entry(branch: str, target: str):
def get_changelog_header_lines(branch: str):
name = Git("config", "user.name").firstline()
email = Git("config", "user.email").firstline()
@@ -488,20 +488,18 @@ def generate_changelog_entry(branch: str, target: str):
month = now.strftime("%B").capitalize()
timestamp = now.strftime(f"{weekday}, %e de {month} de %Y, %H:%M")
entry_lines = [
return [
f"## {timestamp}",
"",
"### Autor",
"",
f"- Usuario: **{name}**",
f"- Email: **{email}**",
f"- Autor: [{name}](mailto:{email})",
f"- Rama: `{branch}`",
"",
"### Commits",
"",
f"Rama: **{branch}**",
""
]
def get_changelog_content_lines(target: str):
lines = []
commits = Git("log", target + "..", first_parent=True, format="%h", merges=False).lines()
for commit in commits:
@@ -514,28 +512,35 @@ def generate_changelog_entry(branch: str, target: str):
commit_type = message[:index]
commit_message = message[index+1:]
entry_lines.append(f"- **{commit_type}**: {commit_message} ({commit})")
lines.append(f"- **{commit_type}**: {commit_message} ({commit})")
diff_tree = Git("diff-tree", commit, r=True, commit_id=False, name_status=True).lines()
for diff in diff_tree:
[status, filename] = diff.split("\t")
entry_lines.append(f"\t- {filename} ({status})")
lines.append(f"\t- {filename} ({status})")
entry_lines += [
return lines
def get_changelog_footer_lines():
return [
"",
"---",
"",
""
]
def generate_changelog_entry(branch: str, target: str):
entry_lines = get_changelog_header_lines(branch)
entry_lines += get_changelog_content_lines(target)
entry_lines += get_changelog_footer_lines()
return "\n".join(entry_lines)
def create_pull_request(service: str, repository: str, source: str, destination: str):
endpoint = get_api_endpoint(service, repository, "/pullrequests")
title = source.replace("/", ": ").replace("-", " ")
lines = generate_changelog_entry(source, destination).splitlines()
description = "\n".join(lines[3:-4])
description = "\n".join(get_changelog_content_lines(destination))
headers = get_headers()
json = {
@@ -549,7 +554,8 @@ def create_pull_request(service: str, repository: str, source: str, destination:
request = requests.post(endpoint, headers=headers, json=json)
if request.ok:
print("PR creado exitosamente.")
json = request.json()
print_success("PR creado exitosamente: " + json['links']['html']['href'])
else:
print_error("Ocurrió un error al crear el PR: " + request.text)
+3
View File
@@ -54,6 +54,9 @@ def print_error(message: str):
def print_warning(message: str):
print(f"{COLOR_YELLOW}[wrn] {message}{COLOR_RESET}")
def print_success(message: str):
print(f"{COLOR_GREEN}[ok!] {message}{COLOR_RESET}")
def print_info(message: str):
print(f"{COLOR_BLUE}[inf] {message}{COLOR_RESET}")