Github V3 API : 列出贡献者
Github V3 API : list contributors
我已阅读以下文档 (https://developer.github.com/v3/repos/#list-contributors) 列出我工作过的存储库上的贡献者,我可以看到没有出现一个提交多次的人,而我自己只有 3 个贡献而我推动了大部分 301 次提交。
我不太明白这个终点是什么 returns,但它看起来并不准确。该文档对此不是很详细,有人知道可以解释它的内容吗?
我向 Github API 的支持人员提交了我的问题,他们给了我一个非常详细的答案。这是(缩写):
It looks like your missing commits were authored with an email address
not linked to your GitHub profile. You can find the missing email by
adding ".patch" to the end of a commit URL, then looking at the
"From:" line. Once you have the email, you can link it to your profile
by following these instructions:
https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user
After you link your email to your account, any valid missing
contributions will be backfilled and new ones should show up
automatically.
For example, when I check out the Projet-merou's commit history:
https://github.com/jxw1102/Projet-merou/commits/master
When I choose the latest commit with your GitHub username as its
author and add .patch to the URL like so:
https://github.com/jxw1102/Projet-merou/commit/f5bf30243ab99efc40802d3d78c08e49839ec9c9.patch
I see this on the second line:
From: Dicee courtinot.david@orange.fr
Adding that email will backfill any missing valid contributions. After
you do that, calling the API should show the expected result.
API Endpoints: Contributors and Contributors Statistics
I have written up some notes about each endpoint below. Let me know
if you have any questions!
/repos/:owner/:repo/contributors
When you call GET /repos/:owner/:repo/contributors
, the GitHub API
will list contributors to the specified repository, sorted by the
number of commits per contributor in descending order. Contributors
data is cached for performance reasons. This endpoint may return
information that is a few hours old. Git contributors are identified
by author email address. This API attempts to group contribution
counts by GitHub user, across all of their associated email addresses.
For performance reasons, only the first 500 author email addresses in
the repository will be linked to GitHub users. The rest will appear as
anonymous contributors without associated GitHub user information.
If you call this endpoint with anon=1
specified, the API will return
a count of all commits on the default branch, including commits that
aren't associated with any user on GitHub. Here's an example:
https://api.github.com/repos/jxw1102/Projet-merou/contributors?anon=1
When anon=1
isn't specified like this:
https://api.github.com/repos/jxw1102/Projet-merou/contributors
notice how the results only show commits associated with some GitHub
user and doesn't count merge commits.
/repos/:owner/:repo/stats/contributors
When you call GET /repos/:owner/:repo/stats/contributors
, the GitHub
API will return the contributors list with additions, deletions, and
commit counts. The total denotes the total number of commits authored
by the contributor.
Does that help?
All the best,
Francis
@francisfuzz
GitHub Support
在我将 devel 合并到 master 之后,我遇到了同样的问题。缺少贡献者。 GitHub支持回复:
That's expected behavior -- please read the documentation for that
endpoint:
https://developer.github.com/v3/repos/#list-contributors
"This endpoint may return information that is a few hours old because
the GitHub REST API v3 caches contributor data to improve
performance."
So, you might need to wait a few hours to get updated data.
我已阅读以下文档 (https://developer.github.com/v3/repos/#list-contributors) 列出我工作过的存储库上的贡献者,我可以看到没有出现一个提交多次的人,而我自己只有 3 个贡献而我推动了大部分 301 次提交。
我不太明白这个终点是什么 returns,但它看起来并不准确。该文档对此不是很详细,有人知道可以解释它的内容吗?
我向 Github API 的支持人员提交了我的问题,他们给了我一个非常详细的答案。这是(缩写):
It looks like your missing commits were authored with an email address not linked to your GitHub profile. You can find the missing email by adding ".patch" to the end of a commit URL, then looking at the "From:" line. Once you have the email, you can link it to your profile by following these instructions:
https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user
After you link your email to your account, any valid missing contributions will be backfilled and new ones should show up automatically.
For example, when I check out the Projet-merou's commit history:
https://github.com/jxw1102/Projet-merou/commits/master
When I choose the latest commit with your GitHub username as its author and add .patch to the URL like so:
https://github.com/jxw1102/Projet-merou/commit/f5bf30243ab99efc40802d3d78c08e49839ec9c9.patch
I see this on the second line:
From: Dicee courtinot.david@orange.fr
Adding that email will backfill any missing valid contributions. After you do that, calling the API should show the expected result.
API Endpoints: Contributors and Contributors Statistics
I have written up some notes about each endpoint below. Let me know if you have any questions!
/repos/:owner/:repo/contributors
When you call
GET /repos/:owner/:repo/contributors
, the GitHub API will list contributors to the specified repository, sorted by the number of commits per contributor in descending order. Contributors data is cached for performance reasons. This endpoint may return information that is a few hours old. Git contributors are identified by author email address. This API attempts to group contribution counts by GitHub user, across all of their associated email addresses. For performance reasons, only the first 500 author email addresses in the repository will be linked to GitHub users. The rest will appear as anonymous contributors without associated GitHub user information.If you call this endpoint with
anon=1
specified, the API will return a count of all commits on the default branch, including commits that aren't associated with any user on GitHub. Here's an example:https://api.github.com/repos/jxw1102/Projet-merou/contributors?anon=1
When
anon=1
isn't specified like this:https://api.github.com/repos/jxw1102/Projet-merou/contributors
notice how the results only show commits associated with some GitHub user and doesn't count merge commits.
/repos/:owner/:repo/stats/contributors
When you call
GET /repos/:owner/:repo/stats/contributors
, the GitHub API will return the contributors list with additions, deletions, and commit counts. The total denotes the total number of commits authored by the contributor.Does that help?
All the best,
Francis
@francisfuzz
GitHub Support
在我将 devel 合并到 master 之后,我遇到了同样的问题。缺少贡献者。 GitHub支持回复:
That's expected behavior -- please read the documentation for that endpoint:
https://developer.github.com/v3/repos/#list-contributors
"This endpoint may return information that is a few hours old because the GitHub REST API v3 caches contributor data to improve performance."
So, you might need to wait a few hours to get updated data.