Skip to content
This repository was archived by the owner on Mar 11, 2023. It is now read-only.
This repository was archived by the owner on Mar 11, 2023. It is now read-only.

Idea for a strategy to find the repo from the remote list #39

@Seluj78

Description

@Seluj78

Idea for a strategy to find the repo from the remote list:

  • List all remotes
  • Filter by keeping only the ones targeting github.com
  • Hit the first one on the github API (https://api.github.com/repos/{the_repo})
  • See if it has a "parent" attribute:
    • it it has one, the good one is the parent, and we have the github URL. no longer need to care about knowing its local name.
    • if it has none, lucky you it's the right one

Demo of finding it indirectly:

$ curl https://api.github.com/repos/seluj78/python-docs-fr | jq .parent.url
"https://api.github.com/repos/python/python-docs-fr"

Or demo of lucky "it was the right one so it has no parent":

$ curl https://api.github.com/repos/python/python-docs-fr | jq .parent.url
null

Originally posted by @JulienPalard in #37 (comment)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions