diff --git a/Dockerfile b/Dockerfile index 4558842..c9109cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,6 @@ COPY --from=builder /go/src/github.com/Azure/spec-sla-bot/templates templates/ # Comment out to run the binary in "production" mode: # ENV GO_ENV=production - # Bind the app to 0.0.0.0 so it can be seen from outside the container ENV ADDR=0.0.0.0 diff --git a/actions/event.go b/actions/event.go index e8e4926..802285f 100644 --- a/actions/event.go +++ b/actions/event.go @@ -1,18 +1,39 @@ package actions import ( - "net/http" + "fmt" + "log" - "github.com/Azure/spec-sla-bot/email" "github.com/gobuffalo/buffalo" + "github.com/google/go-github/github" ) // EventListen default implementation. func EventListen(c buffalo.Context) error { - errEmail := email.SendEmailToAssignee() + /*errEmail := email.SendEmailToAssignee() if errEmail != nil { c.Error(http.StatusInternalServerError, errEmail) return errEmail + }*/ //handle secret + request := c.Request() + payload, err := github.ValidatePayload(request, []byte("Secret-Key")) + defer request.Body.Close() + event, err := github.ParseWebHook(github.WebHookType(request), payload) + if err != nil { + log.Printf("could not parse webhook: err=%s\n", err) + return err } - return c.Render(200, r.JSON(map[string]string{"message": "Welcome to Buffalo!"})) + repoName := "" + switch e := event.(type) { + case *github.PullRequestEvent: + if e.Action != nil { + repoName = *e.Repo.FullName + fmt.Printf("Repository Name: %s", *e.Repo.FullName) + } + default: + log.Printf("unknown event type %s\n", github.WebHookType(request)) + return err + } + + return c.Render(200, r.JSON(map[string]string{"message": "Welcome to Buffalo!", "Repository Name": repoName})) } diff --git a/actions/event_test.go b/actions/event_test.go index d927805..d2ad2de 100644 --- a/actions/event_test.go +++ b/actions/event_test.go @@ -1,11 +1,5 @@ package actions -import ( - "testing" - - "github.com/stretchr/testify/require" -) - func (as *ActionSuite) Test_Event_Listen() { as.Fail("Not Implemented!") } diff --git a/finalTemplate.html b/finalTemplate.html index f3b3b77..624d85a 100644 --- a/finalTemplate.html +++ b/finalTemplate.html @@ -18,6 +18,54 @@ Current Requests:
Time Created Title + + #3204 + priyanag + jianghaol + 2018-06-08 23:28:22 +0000 UTC + Adding VirtualWan Swagger + + + + #3202 + akshaysng + lmazuel + 2018-06-08 21:32:45 +0000 UTC + AppGW FIPS mode + + + + #3197 + blueww + lmazuel + 2018-06-08 03:28:04 +0000 UTC + [Storage] update the example of management policy since + + + + #3196 + ankushbin + annatisch + 2018-06-07 23:26:54 +0000 UTC + Merging change from AddStorageSync branch to master. + + + + #3195 + naveedaz + anuchandy + 2018-06-07 21:57:12 +0000 UTC + Add new backup discovery API. Fix error codes for sourc + + + + #3190 + vrdmr + jianghaol + 2018-06-07 06:34:51 +0000 UTC + [Do-Not-Merge][Automation] Refactoring Automation Resou + + #3188 chlahav @@ -40,22 +88,6 @@ Current Requests:
jhendrixM 2018-06-05 23:46:49 +0000 UTC [DO NOT MERGE] Adding Microsoft.DevSpaces Rest API spec - - - - #3185 - emgarten - hovsepm - 2018-06-05 23:02:23 +0000 UTC - Remove subscriptionId uuid format for IotCentral - - - - #3184 - mozehgir - annatisch - 2018-06-05 21:15:53 +0000 UTC - Updating documentation @@ -104,14 +136,6 @@ Current Requests:
lmazuel 2018-06-01 04:00:52 +0000 UTC Consumption specifications for cost insights and report - - - - #3170 - samkreter - marstr - 2018-05-31 23:06:20 +0000 UTC - Adding June Swagger Update - Azure Container Instance @@ -125,7 +149,7 @@ Current Requests:
#3165 jillcary - hovsepm + sergey-sh 2018-05-31 00:28:42 +0000 UTC Adding appRole property to ApplicationCreateParameters @@ -217,14 +241,6 @@ Current Requests:
marstr 2018-05-16 00:56:42 +0000 UTC [App Insights/Operational Insights] New Data Plane API - - - - #3076 - marstr - hovsepm - 2018-05-15 17:22:41 +0000 UTC - Sql/blob auditing @@ -232,7 +248,7 @@ Current Requests:
yaakoviyu jhendrixM 2018-05-15 06:19:09 +0000 UTC - [DO NOT MERGE] Adding Vulnerability Assessment APIs on + Adding Vulnerability Assessment APIs on managed instanc @@ -241,23 +257,6 @@ Current Requests:
lmazuel 2018-05-14 21:03:50 +0000 UTC Fix swagger warnings - - - - #3066 - promoisha - hovsepm - 2018-05-14 17:43:41 +0000 UTC - [API Management] New Api version introduced along with - - - - #3057 - jaredmoo - hovsepm - 2018-05-11 20:13:56 +0000 UTC - Added GET DB extension API -