-
Notifications
You must be signed in to change notification settings - Fork 30
feat(events): add PR merged and PR closed webhook events #1264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [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.