Skip to content
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

Merged
merged 9 commits into from
Oct 25, 2023
Merged

Conversation

abhinav-harness
Copy link
Collaborator

No description provided.

Link: dst.Repo.GitURL,
Clone: dst.Repo.GitURL,
},
PullRequest: scm.PullRequest{
Copy link
Contributor

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)

@@ -236,6 +257,34 @@ func convertPushHook(dst *pushHook) *scm.PushHook {
}
}

func convertPullRequestCommentHook(dst *pullRequestCommentHook) *scm.PullRequestCommentHook {
Copy link
Contributor

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)

@@ -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,
Copy link
Contributor

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)

},
Action: convertAction(src.Trigger),
PullRequest: convertPullReq(src.PullReq, src.Ref, src.Commit),
Repo: convertRepo(src.Repo),
Sender: scm.User{
Copy link
Contributor

Choose a reason for hiding this comment

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

convertUser

ID: dst.Comment.ID,
},
Sender: scm.User{
Email: dst.Principal.Email,
Copy link
Contributor

Choose a reason for hiding this comment

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

convertuser

Link: ref.Repo.GitURL,
Sha: commit.Sha,
Ref: ref.Name,
Author: scm.User{
Copy link
Contributor

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,
Copy link
Contributor

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?

@abhinav-harness abhinav-harness merged commit a5db7f4 into master Oct 25, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants