Skip to content

Conversation

@ecrupper
Copy link
Contributor

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 ref and commit.

PR closed I decided to use the base node for ref and commit to avoid any sort of nefarious activity.

@ecrupper ecrupper requested a review from a team as a code owner February 28, 2025 18:09
@codecov
Copy link

codecov bot commented Feb 28, 2025

Codecov Report

Attention: Patch coverage is 59.25926% with 55 lines in your changes missing coverage. Please review.

Project coverage is 56.63%. Comparing base (ff7c877) to head (0f112b6).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
api/webhook/post.go 0.00% 28 Missing ⚠️
api/build/compile_publish.go 0.00% 11 Missing ⚠️
scm/github/webhook.go 70.00% 4 Missing and 2 partials ⚠️
api/types/build.go 80.76% 2 Missing and 3 partials ⚠️
api/types/actions/pull.go 90.62% 2 Missing and 1 partial ⚠️
util/util.go 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            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     
Files with missing lines Coverage Δ
api/types/events.go 100.00% <100.00%> (ø)
database/testutils/api_resources.go 94.90% <100.00%> (+0.03%) ⬆️
util/util.go 25.30% <0.00%> (-0.63%) ⬇️
api/types/actions/pull.go 93.33% <90.62%> (-0.85%) ⬇️
api/types/build.go 96.87% <80.76%> (-0.70%) ⬇️
scm/github/webhook.go 90.01% <70.00%> (-0.97%) ⬇️
api/build/compile_publish.go 0.00% <0.00%> (ø)
api/webhook/post.go 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

Comment on lines +451 to +461
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)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. is there another way to get PR number?
  2. 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)
Copy link

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)
Copy link

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)
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support PR merged event

3 participants