List stale branches for a repository

Hi,

I am trying to get the list of all the stale branches in my repository. But I can’t any see any API to get the stale branches against a repository.

Is there any API available for this ? or anyother way to do this ?

Your ideas are welcome

Thanks

What do you mean by stale? Like, hasn’t been updated in a specified amount of time (how long)? What about branches that have commits that are on no other branches? You can get the branches and their most recent commit with the following v4 query: query { repository(owner: "python", name: "cpython") { refs(refPrefix: "refs/heads/", first: 99) { nodes { name target { ... on Commit { authoredDate abbreviatedOid } } } } } }

Thanks for your reply @pcm1289 

Yes you are right. A branch that hasn’t been updated in a specified amount of time (ex: 4 weeks) is a stale branch for my consideration.

I want to list the stale branches using github API. I think we can achieve this by using GraphQL, but I need to do this via Github API. Is there any way to do using Github REST API ? 

GraphQL sits on top of REST. Just make a POST with that query but make sure the set the right Accept and Authorization fields in your header. The bottom of this page has an example: https://developer.github.com/v4/guides/intro-to-graphql/