Skip to content

Commit

Permalink
Update handling for when username not configured
Browse files Browse the repository at this point in the history
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) <alexellis2@gmail.com>
  • Loading branch information
alexellis committed Feb 6, 2020
1 parent 3ac2dda commit b30606c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions derek.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions handler/release_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,21 @@ 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()
if index := strings.Index(title, "\n"); index > -1 {
title = title[:index]
}

if len(author) > 0 {
author = "by @" + author
}

output = output + fmt.Sprintf("%s %s%s\n", id, title, author)
}

Expand Down

0 comments on commit b30606c

Please sign in to comment.