-
Notifications
You must be signed in to change notification settings - Fork 234
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
feat: Add pr_comment webhook for harness #280
Conversation
scm/driver/harness/webhook.go
Outdated
Link: dst.Repo.GitURL, | ||
Clone: dst.Repo.GitURL, | ||
}, | ||
PullRequest: scm.PullRequest{ |
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.
minor can we pull out the convert for pullrequest into a separate internal method (technically even repo) to make sure we don't have to duplicate this (which risks errors)
scm/driver/harness/webhook.go
Outdated
@@ -236,6 +257,34 @@ func convertPushHook(dst *pushHook) *scm.PushHook { | |||
} | |||
} | |||
|
|||
func convertPullRequestCommentHook(dst *pullRequestCommentHook) *scm.PullRequestCommentHook { |
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.
minor maybe we shouldn't call the input dst
(destination) when its actually the source of the convertion (we don't update it)
scm/driver/harness/testdata/webhooks/pull_request_comment_created.json.golden
Show resolved
Hide resolved
scm/driver/harness/webhook.go
Outdated
@@ -198,8 +223,8 @@ func convertPullRequestHook(dst *pullRequestHook) *scm.PullRequestHook { | |||
Sha: dst.Commit.Sha, | |||
Ref: dst.Ref.Name, | |||
Author: scm.User{ | |||
Name: dst.Commit.Committer.Identity.Name, | |||
Email: dst.Commit.Committer.Identity.Email, | |||
Name: dst.PullReq.Author.DisplayName, |
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.
there's more info we can set on scm user, like loginname among others?
(can we have common methods that convert principal
to scm.User
(same for others)
scm/driver/harness/webhook.go
Outdated
}, | ||
Action: convertAction(src.Trigger), | ||
PullRequest: convertPullReq(src.PullReq, src.Ref, src.Commit), | ||
Repo: convertRepo(src.Repo), | ||
Sender: scm.User{ |
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.
convertUser
scm/driver/harness/webhook.go
Outdated
ID: dst.Comment.ID, | ||
}, | ||
Sender: scm.User{ | ||
Email: dst.Principal.Email, |
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.
convertuser
scm/driver/harness/webhook.go
Outdated
Link: ref.Repo.GitURL, | ||
Sha: commit.Sha, | ||
Ref: ref.Name, | ||
Author: scm.User{ |
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.
convertUser
func convertUser(principal principal) scm.User { | ||
return scm.User{ | ||
Name: principal.DisplayName, | ||
ID: principal.UID, |
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.
I wonder if this should be Login
vs ID
?
No description provided.