зеркало из https://github.com/Azure/spec-sla-bot.git
Added to EventListen to handle webhook
This commit is contained in:
Родитель
7877f35ea8
Коммит
21c63a6e0b
|
@ -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
|
||||
|
||||
|
|
|
@ -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}))
|
||||
}
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
package actions
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func (as *ActionSuite) Test_Event_Listen() {
|
||||
as.Fail("Not Implemented!")
|
||||
}
|
||||
|
|
|
@ -18,6 +18,54 @@ Current Requests:<br>
|
|||
<th>Time Created</th>
|
||||
<th>Title</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href=https://github.com/Azure/azure-rest-api-specs/pull/3204>#3204 </a></td>
|
||||
<td> priyanag</td>
|
||||
<td>jianghaol</td>
|
||||
<td>2018-06-08 23:28:22 +0000 UTC</td>
|
||||
<td>Adding VirtualWan Swagger
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href=https://github.com/Azure/azure-rest-api-specs/pull/3202>#3202 </a></td>
|
||||
<td>akshaysng</td>
|
||||
<td> lmazuel</td>
|
||||
<td>2018-06-08 21:32:45 +0000 UTC</td>
|
||||
<td>AppGW FIPS mode
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href=https://github.com/Azure/azure-rest-api-specs/pull/3197>#3197 </a></td>
|
||||
<td> blueww</td>
|
||||
<td> lmazuel</td>
|
||||
<td>2018-06-08 03:28:04 +0000 UTC</td>
|
||||
<td>[Storage] update the example of management policy since
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href=https://github.com/Azure/azure-rest-api-specs/pull/3196>#3196 </a></td>
|
||||
<td>ankushbin</td>
|
||||
<td>annatisch</td>
|
||||
<td>2018-06-07 23:26:54 +0000 UTC</td>
|
||||
<td>Merging change from AddStorageSync branch to master.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href=https://github.com/Azure/azure-rest-api-specs/pull/3195>#3195 </a></td>
|
||||
<td> naveedaz</td>
|
||||
<td>anuchandy</td>
|
||||
<td>2018-06-07 21:57:12 +0000 UTC</td>
|
||||
<td>Add new backup discovery API. Fix error codes for sourc
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href=https://github.com/Azure/azure-rest-api-specs/pull/3190>#3190 </a></td>
|
||||
<td> vrdmr</td>
|
||||
<td>jianghaol</td>
|
||||
<td>2018-06-07 06:34:51 +0000 UTC</td>
|
||||
<td>[Do-Not-Merge][Automation] Refactoring Automation Resou
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href=https://github.com/Azure/azure-rest-api-specs/pull/3188>#3188 </a></td>
|
||||
<td> chlahav</td>
|
||||
|
@ -40,22 +88,6 @@ Current Requests:<br>
|
|||
<td>jhendrixM</td>
|
||||
<td>2018-06-05 23:46:49 +0000 UTC</td>
|
||||
<td>[DO NOT MERGE] Adding Microsoft.DevSpaces Rest API spec
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href=https://github.com/Azure/azure-rest-api-specs/pull/3185>#3185 </a></td>
|
||||
<td> emgarten</td>
|
||||
<td> hovsepm</td>
|
||||
<td>2018-06-05 23:02:23 +0000 UTC</td>
|
||||
<td>Remove subscriptionId uuid format for IotCentral
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href=https://github.com/Azure/azure-rest-api-specs/pull/3184>#3184 </a></td>
|
||||
<td> mozehgir</td>
|
||||
<td>annatisch</td>
|
||||
<td>2018-06-05 21:15:53 +0000 UTC</td>
|
||||
<td>Updating documentation
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -104,14 +136,6 @@ Current Requests:<br>
|
|||
<td> lmazuel</td>
|
||||
<td>2018-06-01 04:00:52 +0000 UTC</td>
|
||||
<td>Consumption specifications for cost insights and report
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href=https://github.com/Azure/azure-rest-api-specs/pull/3170>#3170 </a></td>
|
||||
<td>samkreter</td>
|
||||
<td> marstr</td>
|
||||
<td>2018-05-31 23:06:20 +0000 UTC</td>
|
||||
<td>Adding June Swagger Update - Azure Container Instance
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -125,7 +149,7 @@ Current Requests:<br>
|
|||
<tr>
|
||||
<td><a href=https://github.com/Azure/azure-rest-api-specs/pull/3165>#3165 </a></td>
|
||||
<td> jillcary</td>
|
||||
<td> hovsepm</td>
|
||||
<td>sergey-sh</td>
|
||||
<td>2018-05-31 00:28:42 +0000 UTC</td>
|
||||
<td>Adding appRole property to ApplicationCreateParameters
|
||||
</td>
|
||||
|
@ -217,14 +241,6 @@ Current Requests:<br>
|
|||
<td> marstr</td>
|
||||
<td>2018-05-16 00:56:42 +0000 UTC</td>
|
||||
<td>[App Insights/Operational Insights] New Data Plane API
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href=https://github.com/Azure/azure-rest-api-specs/pull/3076>#3076 </a></td>
|
||||
<td> marstr</td>
|
||||
<td> hovsepm</td>
|
||||
<td>2018-05-15 17:22:41 +0000 UTC</td>
|
||||
<td>Sql/blob auditing
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -232,7 +248,7 @@ Current Requests:<br>
|
|||
<td>yaakoviyu</td>
|
||||
<td>jhendrixM</td>
|
||||
<td>2018-05-15 06:19:09 +0000 UTC</td>
|
||||
<td>[DO NOT MERGE] Adding Vulnerability Assessment APIs on
|
||||
<td>Adding Vulnerability Assessment APIs on managed instanc
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -241,23 +257,6 @@ Current Requests:<br>
|
|||
<td> lmazuel</td>
|
||||
<td>2018-05-14 21:03:50 +0000 UTC</td>
|
||||
<td>Fix swagger warnings
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href=https://github.com/Azure/azure-rest-api-specs/pull/3066>#3066 </a></td>
|
||||
<td>promoisha</td>
|
||||
<td> hovsepm</td>
|
||||
<td>2018-05-14 17:43:41 +0000 UTC</td>
|
||||
<td>[API Management] New Api version introduced along with
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href=https://github.com/Azure/azure-rest-api-specs/pull/3057>#3057 </a></td>
|
||||
<td> jaredmoo</td>
|
||||
<td> hovsepm</td>
|
||||
<td>2018-05-11 20:13:56 +0000 UTC</td>
|
||||
<td>Added GET DB extension API
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче