hbbio / forkizard

A wizard for comparing GitHub forks
MIT License
52 stars 8 forks source link

"This branch is even with master." #7

Open abitrolly opened 3 years ago

abitrolly commented 3 years ago

Looks like GitHub switched to dynamically updating this info.

When https://github.com/abitrolly/forkizard is open in browser, it shows that the repo is 1 commit ahead, but curl and forkizard only get test that the branch is even,

floatas commented 2 years ago

If you are not signed in, you won't be able to see ahead/behind

abitrolly commented 2 years ago

I don't see that forkizard allows to login.

floatas commented 2 years ago

What I meant is that github requires you to login in order to see ahead/behind

abitrolly commented 2 years ago

So GitHub broke forkizard?

floatas commented 2 years ago

Looks like it. Also, it's probably against Github policy to scrape this info, might be best to start using Github API.

abitrolly commented 2 years ago

If GitHub API provides anything, it is buried very deep inside. Maybe GraphQL has something.

floatas commented 2 years ago

Yes, you are absolutely right on this one, documentation is too deep. But, someone managed to dig it up: https://api.github.com/repos/{repoOwner}/{repository}/compare/master...{forkOwner}:master

or in c# using octokit await client.Repository.Commit.Compare(...);

You will need github API key

abitrolly commented 2 years ago

I started to experiment with it at https://observablehq.com/@abitrolly/github-api-starter-active-forks but didn't get far ahead. The fancy API limit progress ate all my time, so I didn't even started to do the pagination to count forks with owners. Guess I need to parse Link: headers to know how many pages are there https://docs.github.com/en/rest/guides/traversing-with-pagination and provide manual controls to update the data when hitting API request limits.