Merged in docs/change-changelog-format (pull request #10)
docs: change changelog format Approved-by: Jonathan Teran
This commit is contained in:
@@ -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
|
## Domingo, 2 de Noviembre de 2025, 13:40
|
||||||
|
|
||||||
### Autor
|
### Autor
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ def update_changelog(branch: str, target: str):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def generate_changelog_entry(branch: str, target: str):
|
def get_changelog_header_lines(branch: str):
|
||||||
name = Git("config", "user.name").firstline()
|
name = Git("config", "user.name").firstline()
|
||||||
email = Git("config", "user.email").firstline()
|
email = Git("config", "user.email").firstline()
|
||||||
|
|
||||||
@@ -488,20 +488,18 @@ def generate_changelog_entry(branch: str, target: str):
|
|||||||
month = now.strftime("%B").capitalize()
|
month = now.strftime("%B").capitalize()
|
||||||
timestamp = now.strftime(f"{weekday}, %e de {month} de %Y, %H:%M")
|
timestamp = now.strftime(f"{weekday}, %e de {month} de %Y, %H:%M")
|
||||||
|
|
||||||
entry_lines = [
|
return [
|
||||||
f"## {timestamp}",
|
f"## {timestamp}",
|
||||||
"",
|
"",
|
||||||
"### Autor",
|
f"- Autor: [{name}](mailto:{email})",
|
||||||
"",
|
f"- Rama: `{branch}`",
|
||||||
f"- Usuario: **{name}**",
|
|
||||||
f"- Email: **{email}**",
|
|
||||||
"",
|
"",
|
||||||
"### Commits",
|
"### Commits",
|
||||||
"",
|
|
||||||
f"Rama: **{branch}**",
|
|
||||||
""
|
""
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def get_changelog_content_lines(target: str):
|
||||||
|
lines = []
|
||||||
commits = Git("log", target + "..", first_parent=True, format="%h", merges=False).lines()
|
commits = Git("log", target + "..", first_parent=True, format="%h", merges=False).lines()
|
||||||
|
|
||||||
for commit in commits:
|
for commit in commits:
|
||||||
@@ -514,28 +512,35 @@ def generate_changelog_entry(branch: str, target: str):
|
|||||||
commit_type = message[:index]
|
commit_type = message[:index]
|
||||||
commit_message = message[index+1:]
|
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()
|
diff_tree = Git("diff-tree", commit, r=True, commit_id=False, name_status=True).lines()
|
||||||
|
|
||||||
for diff in diff_tree:
|
for diff in diff_tree:
|
||||||
[status, filename] = diff.split("\t")
|
[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)
|
return "\n".join(entry_lines)
|
||||||
|
|
||||||
|
|
||||||
def create_pull_request(service: str, repository: str, source: str, destination: str):
|
def create_pull_request(service: str, repository: str, source: str, destination: str):
|
||||||
endpoint = get_api_endpoint(service, repository, "/pullrequests")
|
endpoint = get_api_endpoint(service, repository, "/pullrequests")
|
||||||
title = source.replace("/", ": ").replace("-", " ")
|
title = source.replace("/", ": ").replace("-", " ")
|
||||||
lines = generate_changelog_entry(source, destination).splitlines()
|
description = "\n".join(get_changelog_content_lines(destination))
|
||||||
description = "\n".join(lines[3:-4])
|
|
||||||
headers = get_headers()
|
headers = get_headers()
|
||||||
|
|
||||||
json = {
|
json = {
|
||||||
@@ -549,7 +554,8 @@ def create_pull_request(service: str, repository: str, source: str, destination:
|
|||||||
request = requests.post(endpoint, headers=headers, json=json)
|
request = requests.post(endpoint, headers=headers, json=json)
|
||||||
|
|
||||||
if request.ok:
|
if request.ok:
|
||||||
print("PR creado exitosamente.")
|
json = request.json()
|
||||||
|
print_success("PR creado exitosamente: " + json['links']['html']['href'])
|
||||||
else:
|
else:
|
||||||
print_error("Ocurrió un error al crear el PR: " + request.text)
|
print_error("Ocurrió un error al crear el PR: " + request.text)
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ def print_error(message: str):
|
|||||||
def print_warning(message: str):
|
def print_warning(message: str):
|
||||||
print(f"{COLOR_YELLOW}[wrn] {message}{COLOR_RESET}")
|
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):
|
def print_info(message: str):
|
||||||
print(f"{COLOR_BLUE}[inf] {message}{COLOR_RESET}")
|
print(f"{COLOR_BLUE}[inf] {message}{COLOR_RESET}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user