Skip to content

Commit

Permalink
chore: address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
barjin committed Dec 18, 2024
1 parent f679d09 commit e5cbb66
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
10 changes: 5 additions & 5 deletions git-cliff-release/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ inputs:
required: false
type: string
default: ${{ github.token }}
no-github:
description: If set to true, the action will not insert links to GitHub issues and PRs in the release notes and changelog.
add-github-links:
description: If set to false, the action will not insert links to GitHub issues and PRs in the release notes and changelog.
required: false
type: boolean
default: false
default: true
outputs:
is_prerelease:
description: For convenience - was the action triggered with release_type = "prerelease"?
Expand Down Expand Up @@ -107,7 +107,7 @@ runs:
set -x
enhance_context_args=()
if [[ ${{ inputs.no-github }} = true ]]; then
if [[ ${{ inputs.add-github-links }} = false ]]; then
enhance_context_args+=(--no-github)
fi
Expand Down Expand Up @@ -146,7 +146,7 @@ runs:
print_changelog_args+=(--output "$out_file")
fi
if [[ ${{ inputs.no-github }} = true ]]; then
if [[ ${{ inputs.add-github-links }} = false ]]; then
enhance_context_args+=(--no-github)
fi
Expand Down
8 changes: 4 additions & 4 deletions git-cliff-release/cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ body = """
{{ commit.message | escape | upper_first }}\
{% endif %}\
{% if commit.extra.commit_link %} ([{{ commit.id | truncate(length = 7, end = "") }}]({{ commit.extra.commit_link }})){% endif %}\
{% if commit.remote.username and extra.is_release_notes %}\
{{" "}}by @{{ commit.remote.username }}\
{% elif not extra.no_github and commit.remote.username %}\
{{" "}}by [@{{ commit.remote.username }}](https://github.com/{{ commit.remote.username }})\
{% if commit.extra.username and extra.is_release_notes %}\
{{" "}}by @{{ commit.extra.username }}\
{% elif commit.extra.username %}\
{{" "}}by [@{{ commit.extra.username }}](https://github.com/{{ commit.extra.username }})\
{% if commit.extra.closed_issue_links %}\
, closes {{ commit.extra.closed_issue_links | join(sep = ", ") }}\
{% endif %}\
Expand Down
8 changes: 7 additions & 1 deletion git-cliff-release/enhance_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@ def enhance_release(


def enhance_commit(commit: dict[str, Any], pr_issues: dict[int, list[int]]) -> None:
pr_number = commit.get("remote", {}).get("pr_number")
commit_remote = commit.get("remote", {})

pr_number = commit_remote.get("pr_number")
username = commit_remote.get("username")

commit["extra"] = commit["extra"] or {}
commit["extra"]["commit_link"] = f"{repo_url}/commit/{commit['id']}"

if username:
commit["extra"]["username"] = username

if pr_number:
commit["extra"]["closed_issues"] = pr_issues.get(pr_number, [])

Expand Down

0 comments on commit e5cbb66

Please sign in to comment.