hub4j / github-api

Java API for GitHub
https://github-api.kohsuke.org/
MIT License
1.13k stars 723 forks source link

Feature Request: Get template repo details from created repository #1549

Open AmyShields-EN0085 opened 1 year ago

AmyShields-EN0085 commented 1 year ago

It would be great to be able to get the template repository details from a created repo - so you could know what repository the created repo is based off.

This information is available through the rest API.

Example on a simple GET request to https://api.github.com/repos/org/reponame - I would love to expose the template_repository json object

{
    "id":xxxx,
    "node_id": "R_kgDOIQCw0A",
    "name": "test-generic-repo",
    "full_name": "orgt/test-generic-repo",
    "private": true,
    "**template_repository**": {
        "id": 470521023,
        "node_id": "R_kgDOHAuUvw",
        "name": "my-template",
        "full_name": "org/my-template",
        "private": true,
        "owner": {
            "login": "org",
            "id": 69310803,
            "avatar_url": "https://avatars.githubusercontent.com/u/69310803?v=4",
            "gravatar_id": "",
            "url": "https://api.github.com/users/org",
            "html_url": "https://github.com/org",
            "followers_url": "https://api.github.com/users/org/followers",
            "following_url": "https://api.github.com/users/org/following{/other_user}",
            "gists_url": "https://api.github.com/users/org/gists{/gist_id}",
            "starred_url": "https://api.github.com/users/org/starred{/owner}{/repo}",
            "subscriptions_url": "https://api.github.com/users/orgt/subscriptions",
            "organizations_url": "https://api.github.com/users/org/orgs",
            "repos_url": "https://api.github.com/users/org/repos",
            "events_url": "https://api.github.com/users/org/events{/privacy}",
            "received_events_url": "https://api.github.com/users/org/received_events",
            "type": "Organization",
            "site_admin": false
        }
    "network_count": 0,
    "subscribers_count": 0
}
bitwiseman commented 1 year ago

PRs welcome.

robinvandenbogaard commented 1 year ago

Here is the solution @bitwiseman