Skip to content

Commit

Permalink
[SynchronizeReleasesToGithubReleases] Tolerate an empty author
Browse files Browse the repository at this point in the history
  • Loading branch information
rmannibucau committed Dec 28, 2022
1 parent 504afc2 commit 1f0a118
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,15 @@ private CompletableFuture<?> synchronizeReleases(final HttpClient httpClient, fi
.filter(c -> !c.getCommit().getMessage().startsWith("[maven-release-plugin]") &&
!c.getCommit().getMessage().startsWith("skip changelog"))
.sorted(comparing(it -> OffsetDateTime.parse(it.getCommit().getCommitter().getDate())))
.map(c -> "" +
"* [" + c.getCommit().getAuthor().getName() + "](" + c.getAuthor().getHtmlUrl() + "): " +
c.getCommit().getMessage() + (c.getCommit().getMessage().endsWith(".") ? "" : ".") + " [link](" + c.getHtmlUrl() + ").")
.map(c -> {
final var author1 = c.getCommit().getAuthor();
final var author2 = c.getAuthor();
return "" +
"* " + (author2 == null ? author1.getName() : ("[" + ofNullable(author1)
.map(GithubCommitAuthor::getName)
.orElseGet(author2::getLogin) + "](" + author2.getHtmlUrl() + ")")) + ": " +
c.getCommit().getMessage() + (c.getCommit().getMessage().endsWith(".") ? "" : ".") + " [link](" + c.getHtmlUrl() + ").";
})
.collect(joining("\n")))
.thenAccept(msg -> release.setBody(release.getBody() + "\n\n" + msg)))
.orElseGet(() -> completedFuture(null))
Expand Down

0 comments on commit 1f0a118

Please sign in to comment.