Go-github: PullRequestEvent doesn't support "Before" and "After" fields

Created on 28 Jul 2019  路  8Comments  路  Source: google/go-github

Suppose that I have a Pull Request already opened with a commit. Now let's say that I add another commit to that, then a github event pull_reques would be sent with the action as synchronize. But I see that the JSON response has the Before and After fields in it, but the PullRequestEvent is not capturing them. Is there anyway to capture them or would it be possible to add this functionality? Thank you.

Most helpful comment

Thanks for quick response. I've asked them so I'll back here once updated.

All 8 comments

According to the example provided in the GitHub Developer API docs:
https://developer.github.com/v3/activity/events/types/#pullrequestevent

it appears that the "before" and "after" fields are not being sent, but you have seen them in a response (which most likely means that the docs need updating). (Please correct me if I'm not understanding your question properly, and provide a link to help clarify your question.)

Could you please do two things, @Bhargavasomu ?

First, could you please contact [email protected] and describe the situation and request that they update their documentation to include the "before" and "after" fields in the provided PullRequestEvent example?

Second, could you please give us an example response showing exactly where you are seeing these fields so that we can add them to the correct structure?

Thanks.

Closing due to inactivity. Feel free to reopen if there are updates.

@gmlewis Hi, I'm facing the same case and would like to capture it.

Second, could you please give us an example response showing exactly where you are seeing these fields so that we can add them to the correct structure?

Instead, I'd provide an example:

Headers
X-GitHub-Event: pull_request

Payload

{
  "action": "synchronize",
  "number": 381,
  "pull_request": {
    ...
  },
  "before": "13e4edc8620f1135f5070f290f7004a44b1e827b",
  "after": "3b348d92ad430a1e254d4a11f515ecf6ad260648",
  "repository": {
    ...
  },
  "organization": {
    ...
  },
  "sender": {
    ...
  }
}

At least, we can see these fields when the action is synchronize.

FYI: before means the SHA of the most recent commit on聽ref聽before the push.

Thank you, @nakabonne. Can you please contact [email protected] as described above and ask them to please update their documentation, then report back here with the response?

Thanks for quick response. I've asked them so I'll back here once updated.

@gmlewis Hi, I received a response like below from them.

The example in the documentation is not for the synchronizeaction, it's for the opened action, so adding a before and after field would not be correct. The best way to do this would be to add an example for each possible action (e.g. one for opened and one for synchronize) and adding that is already on the team's wishlist.

Because that is already on the team's wishlist, would it be possible to support before and after fields? Or do we have to wait for them to update the doc?

Thanks.

Yes, supporting them sounds like a good idea to me.
Thank you, @nakabonne !

@gmlewis I'll address it in my free time. Or, if you think it's reasonable, could you add good first issue label?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gmlewis picture gmlewis  路  3Comments

adrienzieba picture adrienzieba  路  3Comments

gmlewis picture gmlewis  路  3Comments

dmitshur picture dmitshur  路  3Comments

OGKevin picture OGKevin  路  3Comments