Skip to content

Commit

Permalink
ci: Make the release script add author handles to changelog items (#1069
Browse files Browse the repository at this point in the history
)

This makes GitHub automatically assemble a contributor list at the
bottom of the release.
  • Loading branch information
paulgessinger committed Nov 3, 2021
1 parent d510ac1 commit 46acd17
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions CI/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ def get_current_version():
class Commit:
sha: str
message: str
author: str

def __init__(self, sha: str, message: str):
def __init__(self, sha: str, message: str, author: str):
self.sha = sha
self.message = self._normalize(message)
self.author = author

@staticmethod
def _normalize(message):
Expand Down Expand Up @@ -114,7 +116,7 @@ def generate_changelog(commits, commit_parser=_default_parser) -> dict:
capital_message = (
message.descriptions[0][0].upper() + message.descriptions[0][1:]
)
changes[message.type].append((commit.sha, capital_message))
changes[message.type].append((commit.sha, capital_message, commit.author))

if message.breaking_descriptions:
for paragraph in message.breaking_descriptions:
Expand All @@ -136,8 +138,8 @@ def markdown_changelog(version: str, changelog: dict, header: bool = False) -> s
continue
output += "\n### {0}\n".format(section.capitalize())

for item in items:
output += "* {0} ({1})\n".format(item[1], item[0])
for sha, msg, author in items:
output += "* {} ({}) (@{})\n".format(msg, sha, author)

return output

Expand Down Expand Up @@ -209,7 +211,7 @@ async def get_parsed_commit_range(
commit_message = typer.edit(commit_message)
_default_parser(commit_message)

commit = Commit(commit_hash, commit_message)
commit = Commit(commit_hash, commit_message, item["author"]["login"])
commits.append(commit)

if invalid_message:
Expand Down

0 comments on commit 46acd17

Please sign in to comment.