Are you experiencing an issue with...
:beetle: Description
The fork badge at Sahil Bansal's repo (https://github.com/sahilbansal17/Competitive_Coding) is not being updated. An issue regarding the same on his repo.
:link: Link to the badge
link
:bulb: Possible Solution
NA
I'm not entirely sure what is meant by "badge not updating", although there is indeed a descrepancy between the count of forks shown on the badge, and what GitHub is showing in the UI. Is that what you are referring to?
We switched to GitHub's V4 API for the forks badges not too long ago so I'm wondering that may explain the difference
@calebcartwright Yeah, that's what I ment. :sweat_smile:
So what should be done from repo maintainer/owners' side to make the count of forks shown on the badge same as that shown in the Github UI ?
There's nothing you need to do as a Shields user.
We'll have to dig into the underlying issue. We're only showing the information we get from GitHub's API, so if the API is returning incorrect data then that's an upstream problem
So the GitHub API is, unsurprisingly, returning 184 as the count for the GraphQL query:
query {
repository(owner: "sahilbansal17", name:"Competitive_Coding") {
forks {
totalCount
}
}
}
https://developer.github.com/v4/explorer/
{
"data": {
"repository": {
"forks": {
"totalCount": 184
}
}
}
}
This is an interesting one..
{
repository(owner: "sahilbansal17", name: "Competitive_Coding") {
forks {
totalCount
}
}
}
on the V4 API returns
{
"data": {
"repository": {
"forks": {
"totalCount": 184
}
}
}
}
whereas https://api.github.com/repos/sahilbansal17/Competitive_Coding (V3 API) returns
{
"forks": 198,
}
If you have a look at https://github.com/sahilbansal17/Competitive_Coding/network/members you can see that there are 13 repos listed which are forks of someone else's fork, or forks of forks of forks (second and third order forks). I guess the graphql query we're using is including _only first order forks_ . Doing a bit of searching, if we change the query to
{
repository(owner: "sahilbansal17", name: "Competitive_Coding") {
forkCount
}
}
that will return
{
"data": {
"repository": {
"forkCount": 198
}
}
}
which is the same number used in the GH front-end and V3 API call. I'll do a PR for it in a sec..
Good spot Chris!
Most helpful comment
This is an interesting one..
on the V4 API returns
whereas https://api.github.com/repos/sahilbansal17/Competitive_Coding (V3 API) returns
If you have a look at https://github.com/sahilbansal17/Competitive_Coding/network/members you can see that there are 13 repos listed which are forks of someone else's fork, or forks of forks of forks (second and third order forks). I guess the graphql query we're using is including _only first order forks_ . Doing a bit of searching, if we change the query to
that will return
which is the same number used in the GH front-end and V3 API call. I'll do a PR for it in a sec..