Skip to content

Add github pkg to webhook#1230

Merged
priyawadhwa merged 3 commits intoGoogleContainerTools:masterfrom
priyawadhwa:webhook
Nov 2, 2018
Merged

Add github pkg to webhook#1230
priyawadhwa merged 3 commits intoGoogleContainerTools:masterfrom
priyawadhwa:webhook

Conversation

@priyawadhwa
Copy link
Copy Markdown
Contributor

This is the final piece of the webhook, which should allow it to comment
on github PRs when the sample websites are ready and remove labels from
PRs.

I also made some small logging and error handling changes to make them
easier to read. I also tested the full flow on a sample PR and it seems to be
working as expected.

This is the final piece of the webhook, which should allow it to comment
on github PRs when the sample websites are ready and remove labels from
PRs.

I also made some small logging and error handling changes to make them
easier to read. I also tested the full flow on a sample PR and it seems to be
working as expected.
@codecov-io
Copy link
Copy Markdown

codecov-io commented Nov 2, 2018

Codecov Report

Merging #1230 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1230   +/-   ##
=======================================
  Coverage   41.45%   41.45%           
=======================================
  Files          96       96           
  Lines        4238     4238           
=======================================
  Hits         1757     1757           
  Misses       2310     2310           
  Partials      171      171

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3428417...5e75adf. Read the comment docs.

Copy link
Copy Markdown
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

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

only some nits but otherwise LGTM.

if err != nil {
return errors.Wrap(err, "creating github comment")
}
log.Printf("Succesfully commented on PR %d.", pr.GetNumber())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
log.Printf("Succesfully commented on PR %d.", pr.GetNumber())
log.Printf("Successfully commented on PR %d", pr.GetNumber())

}
// TODO: priyawadhwa@ to add logic for commenting on Github once the deployment is ready

// Now, comment on the PR and remove the docs-modifications label
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Now, comment on the PR and remove the docs-modifications label
// comment on the PR and remove the docs-modifications label

// CommentOnPR comments message on the PR
func (g *Client) CommentOnPR(pr *github.PullRequestEvent, message string) error {
comment := &github.IssueComment{
Body: &[]string{message}[0],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this looks weird... why isn't this just message?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

whoops my bad, Body requires a string pointer and previously I was setting "message" directly in the array. fixed now!

@priyawadhwa priyawadhwa merged commit 23693e8 into GoogleContainerTools:master Nov 2, 2018
@priyawadhwa priyawadhwa deleted the webhook branch November 2, 2018 22:13
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