Skip to content

Commit 2d229da

Browse files
authored
ci: Adjust closed issue rendering in git-cliff-release (#139)
* Adjust closed issue rendering in git-cliff-release * Capitalize
1 parent 2481fb8 commit 2d229da

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

git-cliff-release/cliff.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ body = """
2121
{% elif version %}
2222
## {{ version | trim_start_matches(pat="v") }}
2323
{% else %}\
24-
## unreleased
24+
## Unreleased
2525
{% endif %}\
2626
{% for group, commits in commits | group_by(attribute="group") %}
2727
### {{ group | striptags | trim | upper_first }}
@@ -38,6 +38,9 @@ body = """
3838
{{" "}}by @{{ commit.remote.username }}\
3939
{% elif commit.remote.username %}\
4040
{{" "}}by [@{{ commit.remote.username }}](https://github.com/{{ commit.remote.username }})\
41+
{% if commit.extra.closed_issue_links %}\
42+
, closes {{ commit.extra.closed_issue_links | join(sep = ", ") }}
43+
{% endif %}\
4144
{%- endif %}\
4245
{% endfor %}
4346
{% endfor %}\n

git-cliff-release/enhance_context.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,15 @@ def enhance_commit(commit: dict[str, Any], pr_issues: dict[int, list[int]]) -> N
4949
if pr_number:
5050
commit["extra"]["closed_issues"] = pr_issues.get(pr_number, [])
5151

52+
pr_link = f"{repo_url}/pulls/{pr_number}"
53+
commit["extra"]["pr_link"] = f"([#{pr_number}]({pr_link}))"
5254
commit["extra"]["raw_pr_link"] = f"(#{pr_number})"
5355

54-
pr_link = f"{repo_url}/pulls/{pr_number}"
55-
issue_links = [
56+
commit["extra"]["closed_issue_links"] = [
5657
f"[#{issue}]({repo_url}/issues/{issue})"
5758
for issue in commit["extra"]["closed_issues"]
5859
]
5960

60-
if issue_links:
61-
commit["extra"]["pr_link"] = (
62-
f"([#{pr_number}]({pr_link}), closes {', '.join(issue_links)})"
63-
)
64-
else:
65-
commit["extra"]["pr_link"] = f"([#{pr_number}]({pr_link}))"
66-
6761

6862
parser = ArgumentParser()
6963
parser.add_argument("--repo", type=str, required=True)

0 commit comments

Comments
 (0)