Skip to content

Add DeliveryID function for webhook events - #619

Merged
dmitshur merged 3 commits into
google:masterfrom
drewfradette:delivery-id
Apr 21, 2017
Merged

dmitshur merged 3 commits into
google:masterfrom
drewfradette:delivery-id

Conversation

@drewfradette

Copy link
Copy Markdown
Contributor

Addresses #618

@googlebot

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

@drewfradette

Copy link
Copy Markdown
Contributor Author

I was using the wrong git config, I've addressed the googlebot's issue above.

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

@dmitshur dmitshur left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks!

One optional comment.

We just need to resolve the CLA stuff. I think if you push the commit with matching git author and committer, the bot should be able to pick it up. Edit: This is taken care of by now, great!

Comment thread github/messages.go
return r.Header.Get(eventTypeHeader)
}

// DeliveryID returns the unique delivery ID of webhook request r.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps it's a good idea to link to the relevant GitHub API docs here?

// DeliveryID returns the unique delivery ID of webhook request r.
//
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#webhook-headers

If you want to, you can add the same to docs of WebHookType.

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.

Done!

@dmitshur
dmitshur requested a review from gmlewis April 19, 2017 14:22
Comment thread github/messages_test.go Outdated

got := DeliveryID(req)
if got != id {
t.Errorf("DeliveryID(%#v) = %#v, want %#v", req, got, id)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: since got and id are both strings, you may want to use %q for these values instead of %#v.

t.Errorf("DeliveryID(%#v) = %q, want %q", req, got, id)

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.

Done!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Drew, the commit message of ffae808 is "Fix formatting of test output". However, both %#v and %q produce same results for string type. It wasn't wrong, this is a mere style change. Just wanted to point that out FYI.

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.

Yeah, sorry, bad wording. I meant "fixed" in the context of "for the review". Would you like me to change the commit message to be more precise?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No problem. No need to change the commit message, this PR will be squashed into 1 commit when merging anyway, and the review-specific parts don't need to be included.

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Thank you, @drewfradette and @shurcooL!

@dmitshur
dmitshur merged commit fb770fa into google:master Apr 21, 2017
@dmitshur

Copy link
Copy Markdown
Member

Thanks @drewfradette!

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.

4 participants