Skip to content

Commit

Permalink
Merge pull request #1 from wesker-albert/add-github-support
Browse files Browse the repository at this point in the history
add github author, new label format
  • Loading branch information
wesker-albert authored Jan 13, 2024
2 parents 0085753 + 8f14ce7 commit 162ed6f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/gitchangelog/gitchangelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,13 @@ def authors(self):
co_authors = getattr(self, 'trailer_co_authored_by', [])
co_authors = co_authors if isinstance(co_authors, list) else [co_authors]
return sorted(co_authors + ["%s <%s>" % (self.author_name, self.author_email)])

@property
def author_github(self):
if not self.author_email:
return ""
sub = re.search("\+(.*?)\@", self.author_email)
return sub.group(1) if sub else ""

@property
def date(self):
Expand Down Expand Up @@ -1174,7 +1181,7 @@ def rest_title(label, char="="):

def render_version(version):
title = (
"%s (%s)" % (version["tag"], version["date"])
"[%s] - %s" % (version["tag"], version["date"])
if version["tag"]
else opts["unreleased_version_label"]
)
Expand Down Expand Up @@ -1231,7 +1238,7 @@ def mustache(template_name):
def stuffed_versions(versions, opts):
for version in versions:
title = (
"%s (%s)" % (version["tag"], version["date"])
"[%s] - %s" % (version["tag"], version["date"])
if version["tag"]
else opts["unreleased_version_label"]
)
Expand Down Expand Up @@ -1480,6 +1487,7 @@ def versions_data_iter(
{
"author": commit.author_name,
"authors": commit.author_names,
"author_github": commit.author_github,
"subject": subject_process(commit.subject),
"body": body_process(commit.body),
"commit": commit,
Expand Down

0 comments on commit 162ed6f

Please sign in to comment.