feat(events): add PR merged and PR closed webhook events#1264
feat(events): add PR merged and PR closed webhook events#1264
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1264 +/- ##
==========================================
+ Coverage 56.60% 56.63% +0.03%
==========================================
Files 629 629
Lines 35653 35763 +110
==========================================
+ Hits 20180 20254 +74
- Misses 14792 14824 +32
- Partials 681 685 +4
|
| if b.GetEventAction() == constants.ActionMerged && b.GetEvent() == constants.EventPull { | ||
| numStr := strings.TrimPrefix(b.GetMessage(), "Merged PR #") | ||
|
|
||
| return strconv.Atoi(numStr) | ||
| } | ||
|
|
||
| if b.GetEventAction() == constants.ActionClosed && b.GetEvent() == constants.EventPull { | ||
| numStr := strings.TrimPrefix(b.GetMessage(), "Closed PR #") | ||
|
|
||
| return strconv.Atoi(numStr) | ||
| } |
There was a problem hiding this comment.
- is there another way to get PR number?
- related to 1., is this GitHub specific message formatting?
|
|
||
| // verify the webhook from the source control provider | ||
| if c.Value("webhookvalidation").(bool) { | ||
| err = scm.FromContext(c).VerifyWebhook(ctx, dupRequest, repo) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cannot use repo (variable of type *"github.com/go-vela/server/api/types".Repo) as []byte value in argument to scm.FromContext(c).VerifyWebhook
|
|
||
| // verify the webhook from the source control provider | ||
| if c.Value("webhookvalidation").(bool) { | ||
| err = scm.FromContext(c).VerifyWebhook(ctx, dupRequest, repo) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cannot use repo (variable of type *"github.com/go-vela/server/api/types".Repo) as []byte value in argument to scm.FromContext(c).VerifyWebhook
|
|
||
| // verify the webhook from the source control provider | ||
| if c.Value("webhookvalidation").(bool) { | ||
| err = scm.FromContext(c).VerifyWebhook(ctx, dupRequest, repo) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cannot use repo (variable of type *"github.com/go-vela/server/api/types".Repo) as []byte value in argument to scm.FromContext(c).VerifyWebhook
closes go-vela/community#1030
adding a new webhook event action as a Vela capability.
PR merged payload has a merge commit that can be grabbed to use as the
refandcommit.PR closed I decided to use the base node for ref and commit to avoid any sort of nefarious activity.