From b30606c1d2761ba04cb076c98177ed0b1c6dd5a9 Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Thu, 6 Feb 2020 12:45:18 +0000 Subject: [PATCH] Update handling for when username not configured Sometimes a GitHub username / login was not given, so we can now handle that by printing the name from the commit. Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- derek.yml | 4 ++-- handler/release_handler.go | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/derek.yml b/derek.yml index 23ee1c9..97f584a 100644 --- a/derek.yml +++ b/derek.yml @@ -3,9 +3,9 @@ provider: gateway: http://127.0.0.1:8080 functions: - derek-098: + derek-0911: handler: ./ - image: alexellis/derek:0.9.9 + image: alexellis/derek:0.9.11 lang: dockerfile environment: debug: true diff --git a/handler/release_handler.go b/handler/release_handler.go index 84b2bd4..348134e 100644 --- a/handler/release_handler.go +++ b/handler/release_handler.go @@ -83,8 +83,14 @@ func updateReleaseNotes(client *github.Client, owner, repo, latestTag string) er author := c.GetAuthor().GetLogin() - if len(author) == 0 { - author = c.GetCommit().GetAuthor().GetLogin() + // log.Println("1", c.GetAuthor()) + // log.Println("2", c.GetCommitter()) + // log.Println("3", c.GetCommit().GetAuthor()) + + if len(author) > 0 { + author = " by @" + author + } else { + author = " by " + c.GetCommit().GetAuthor().GetName() } title := c.GetCommit().GetMessage() @@ -92,10 +98,6 @@ func updateReleaseNotes(client *github.Client, owner, repo, latestTag string) er title = title[:index] } - if len(author) > 0 { - author = "by @" + author - } - output = output + fmt.Sprintf("%s %s%s\n", id, title, author) }