Skip to content

Add AuthorAssociation field in struct PullRequest - #802

Merged
dmitshur merged 1 commit into
google:masterfrom
allencloud:patch-1
Dec 2, 2017
Merged

dmitshur merged 1 commit into
google:masterfrom
allencloud:patch-1

Conversation

@allencloud

Copy link
Copy Markdown
Contributor

I see that when a user contributes to a repo at his first time, the github will show this contributor is the-first-time-contributor. And I contact with developers in github about how to get this field in API.
And they said they design a new Field AuthorAssociation in pullrequest struct. Although this is not documented in github API docs.

I think it is important, so I try to add this field.

@googlebot googlebot added the cla: yes Indication that the PR author has signed a Google Contributor License Agreement. label Dec 1, 2017
@dmitshur

dmitshur commented Dec 2, 2017

Copy link
Copy Markdown
Member

You'll need to run go generate to update a generated part of this package too. See step 5 of https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch.

@dmitshur

dmitshur commented Dec 2, 2017 •

Copy link
Copy Markdown
Member

It's unfortunate that the field isn't documented. But it's easy to confirm it's there, e.g., https://api.github.com/repos/google/go-github/pulls/802:

{
  ...
  "author_association": "CONTRIBUTOR",
  ...
}

LGTM, just need to update the generated file.

@dmitshur

dmitshur commented Dec 2, 2017

Copy link
Copy Markdown
Member

It's unfortunate that the field isn't documented.

FWIW, this field is documented as part of GitHub's v4 API:
image

Signed-off-by: Allen Sun <shlallen1990@gmail.com>
@allencloud

Copy link
Copy Markdown
Contributor Author

Thanks for your detailed guide. I have updated the generating thing . PTAL @shurcooL
Thanks a lot.

@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!

@dmitshur
dmitshur merged commit d4f26c3 into google:master Dec 2, 2017
@dmitshur

dmitshur commented Dec 2, 2017

Copy link
Copy Markdown
Member

If you want, it'd be helpful to contact GitHub support and let them know this field is missing in the docs at https://developer.github.com/v3/pulls/, so it can be added there (and gain more confidence in being able to rely on it).

Caution should be taken using it given it is not documented (but I suspect it's likely because they haven't gotten around to updating the v3 docs yet).

@allencloud
allencloud deleted the patch-1 branch December 2, 2017 09:44
nbareil pushed a commit to nbareil/go-github that referenced this pull request May 1, 2018
The field contains the author association with the repository,
e.g., "COLLABORATOR", "CONTRIBUTOR", "NONE", etc.

It's not currently documented at https://developer.github.com/v3/pulls/ but
is present in GitHub API v3 responses. It's documented in GitHub API v4 at
https://developer.github.com/v4/reference/object/pullrequest/#fields and
https://developer.github.com/v4/reference/enum/commentauthorassociation/.
jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
The field contains the author association with the repository,
e.g., "COLLABORATOR", "CONTRIBUTOR", "NONE", etc.

It's not currently documented at https://developer.github.com/v3/pulls/ but
is present in GitHub API v3 responses. It's documented in GitHub API v4 at
https://developer.github.com/v4/reference/object/pullrequest/#fields and
https://developer.github.com/v4/reference/enum/commentauthorassociation/.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Indication that the PR author has signed a Google Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants