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

Add github pkg to webhook #1230

Merged
merged 3 commits into from
Nov 2, 2018

Conversation

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

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
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
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())

}
if err := kubernetes.WaitForDeploymentToStabilize(deployment); err != nil {
return errors.Wrapf(err, "waiting for deployment %s to stabilize", deployment.Name)
}
// 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
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
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
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