Home > Software design >  How do I programattically identify forked github repos?
How do I programattically identify forked github repos?

Time:03-15

Using the github API, how can I determine if a repo has been forked from another repo? An example using gh api would be ideal.

Context: I would like to apply some different automated processing to my github repos depending on whether or not they have been forked from another repo.

CodePudding user response:

Thanks, but that doesn't work for private repos

An API call would work if you are using an account which has the right to access said private repository.

I just tested with a private repository of mine:

echo ghp_YOUR_TOKEN| gh auth login --with-token
gh api --method=GET repos/<user>/<repo> --jq ".fork"
false/true
  • Related