From 1caafc15ef7f613f80294a5bb1d99aeaf4bafa39 Mon Sep 17 00:00:00 2001 From: lbowsher Date: Fri, 28 Aug 2020 01:30:42 -0400 Subject: [PATCH] trying new comment parsing approach --- RetestPrototype/main.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/RetestPrototype/main.go b/RetestPrototype/main.go index 3a24a8b..343ef4d 100644 --- a/RetestPrototype/main.go +++ b/RetestPrototype/main.go @@ -54,7 +54,7 @@ func handleWebhook(w http.ResponseWriter, r *http.Request) { owner = repo.GetOwner().GetLogin() number = e.GetIssue().GetNumber() //log.Println(e.GetNumber()) - parseComment(*e.GetComment()) + log.Println(parseCommentForRetest(*e.GetComment())) default: log.Printf("unknown event type %s\n", github.WebHookType(r)) return @@ -71,6 +71,16 @@ func parseComment(com github.IssueComment) { } } +// Checks to see if /retest is in the comment and on it's own line +func parseCommentForRetest(com github.IssueComment) bool { + body := com.GetBody() + //log.Println(body) + if strings.Contains(body, "\n/retest\n") { + return true + } + return false +} + // writes Retest Initiated after func writeComment() { //getting the github client