docs: cambio descripcion de PR para que solo contenga los commits

This commit is contained in:
jt
2025-11-02 13:54:55 -03:00
parent e275985fc1
commit 1de6a64176
2 changed files with 25 additions and 19 deletions
+22 -19
View File
@@ -493,21 +493,13 @@ def get_changelog_header_lines(branch: str):
"", "",
f"- Autor: [{name}](mailto:{email})", f"- Autor: [{name}](mailto:{email})",
f"- Rama: `{branch}`", f"- Rama: `{branch}`",
"" "",
"### Commits" "### Commits",
"" ""
] ]
def get_changelog_footer_lines(): def get_changelog_content_lines(target: str):
return [ lines = []
"",
"---",
"",
""
]
def generate_changelog_entry(branch: str, target: str):
entry_lines = get_changelog_header_lines(branch)
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:
@@ -520,13 +512,26 @@ 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})")
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() entry_lines += get_changelog_footer_lines()
return "\n".join(entry_lines) return "\n".join(entry_lines)
@@ -535,10 +540,7 @@ def generate_changelog_entry(branch: str, target: str):
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))
header_lines = get_changelog_header_lines(source)
footer_lines = get_changelog_footer_lines()
description = "\n".join(lines[len(header_lines):-len(footer_lines)])
headers = get_headers() headers = get_headers()
json = { json = {
@@ -552,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.") print_success("PR creado exitosamente.")
print_debug("Response body: " + request.text)
else: else:
print_error("Ocurrió un error al crear el PR: " + request.text) 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): 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}")