Skip to content

Commit

Permalink
in release_merge_info: handle merges with no description (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
javierggt committed Aug 23, 2023
1 parent 10c57c2 commit 45279c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion skare3_tools/github/scripts/release_merge_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@ def get_merges(repository, sha):
for commit in commits:
msg = commit["commit"]["message"]
match = re.match(
r"Merge pull request (?P<pr>.+) from (?P<branch>\S+)\n\n(?P<description>.+)",
r"Merge pull request (?P<pr>.+) from (?P<branch>\S+)(\n\n(?P<description>.+))?",
msg,
)
if match:
msg = match.groupdict()
if msg["pr"][0] == "#":
if msg["description"] is None:
msg["description"] = repo.pull_requests(msg["pr"][1:])[0]['title']
msg["pr"] = (
f'[{msg["pr"]}]'
f'(https://github.com/{repository}/pull/{msg["pr"][1:]})'
Expand Down
4 changes: 2 additions & 2 deletions skare3_tools/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def _get_repository_info_v4(

release_info[-1]["commits"].append(commit)
match = re.match(
r"Merge pull request #(?P<pr_number>.+) from (?P<branch>\S+)\n\n(?P<title>.+)",
r"Merge pull request #(?P<pr_number>.+) from (?P<branch>\S+)(\n\n(?P<title>.+))?",
commit["message"],
)
if match:
Expand All @@ -496,7 +496,7 @@ def _get_repository_info_v4(
merge["author"] = all_pull_requests[merge["pr_number"]]["author"][
"name"
]
if use_pr_titles:
if use_pr_titles or merge['title'] is None:
# some times PR titles are changed after merging. Use that instead of the commit
merge["title"] = all_pull_requests[merge["pr_number"]][
"title"
Expand Down

0 comments on commit 45279c8

Please sign in to comment.