[GraphQL] - Fetch tags by tag name prefix

Hi,

I want to fetch the tags using GraphQL API where tag start with some particular letters/namespace. Is it possible using the GraphQL API?

I’ve seen the following in the REST API, 

https://api.github.com/repos/parcel-bundler/parcel/git/refs/tags/@parcel/

https://api.github.com/repos/parcel-bundler/parcel/git/refs/tags/@parcel/babel-register

https://api.github.com/repos/parcel-bundler/parcel/git/refs/tags/@parcel/integration-tests

We can filter the tags based on namespace but I’m not able to achieve the same using the GraphQL API. 

I tried the following query, 

{
  repository(owner: "parcel-bundler", name: "parcel") {
    refs(refPrefix: "refs/tags/@parcel/integration-tests/", first: 10) {
      totalCount
      edges {
        cursor
      }
      pageInfo {
        hasPreviousPage
        endCursor
        startCursor
        hasNextPage
      }
    }
  }
}

But it doesn’t return any results. I’m also interested if I can filter the tags by some prefix. e.g. If I want to find all tags starting from " 1.1". How can I achieve it?

Thanks!

From what I understand, the refPrefix parameter only allows you to select between refs/heads/ (in other words, branches) and refs/tags/ (in other words, tags). Anything beyond that will not work. So, as far as I know, there isn’t an easy way to filter tags like you’re asking for.

I hope that helps!