Skip to content

Commit 678329a

Browse files
committed
Fix Changelog Build
1 parent 316f7ae commit 678329a

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

jupyter_releaser/changelog.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ def format_pr_entry(target, number, auth=None):
4141

4242

4343
def get_version_entry(
44-
branch, repo, version, *, since=None, auth=None, resolve_backports=False
44+
branch,
45+
repo,
46+
version,
47+
*,
48+
since=None,
49+
auth=None,
50+
resolve_backports=False,
51+
remote="origin",
4552
):
4653
"""Get a changelog for the changes since the last tag on the given branch.
4754
@@ -59,17 +66,25 @@ def get_version_entry(
5966
The GitHub authorization token
6067
resolve_backports: bool, optional
6168
Whether to resolve backports to the original PR
69+
remote: str, optional
70+
The remote target (default is origin)
6271
6372
Returns
6473
-------
6574
str
6675
A formatted changelog entry with markers
6776
"""
68-
since = since or util.get_latest_tag(branch)
77+
78+
if not since:
79+
tags = util.run(
80+
f"git --no-pager tag --sort=-creatordate --merged {remote}/{branch}"
81+
)
82+
if tags:
83+
since = tags.splitlines()[0]
6984

7085
util.log(f"Getting changes to {repo} since {since} on branch {branch}...")
7186

72-
until = util.run(f'git --no-pager log -n 1 {branch} --pretty=format:"%H"')
87+
until = util.run(f'git --no-pager log -n 1 {remote}/{branch} --pretty=format:"%H"')
7388
until = until.replace("%", "")
7489

7590
md = generate_activity_md(
@@ -139,7 +154,7 @@ def build_entry(branch, repo, auth, changelog_path, since, resolve_backports):
139154

140155
# Get changelog entry
141156
entry = get_version_entry(
142-
f"origin/{branch}",
157+
branch,
143158
repo,
144159
version,
145160
since=since,
@@ -211,7 +226,7 @@ def check_entry(branch, repo, auth, changelog_path, since, resolve_backports, ou
211226
repo = repo or util.get_repo()
212227

213228
raw_entry = get_version_entry(
214-
f"origin/{branch}",
229+
branch,
215230
repo,
216231
version,
217232
since=since,

0 commit comments

Comments
 (0)