How to retrieve date of release on v4?


#1

So I’m using this to retrieve my tags:

query {
  repository(owner: "peercoin", name: "peercoin") {
    tags: refs(refPrefix: "refs/tags/", last: 30) {
      edges {
        tag: node {
          name
          target {
            ... on Tag {
              commitUrl
              message
            } 
          }
        }
      }
    }
  }
}

But I can’t manage to retrieve the release date from each tag. Tag doens’t seem to expose that. Is it possible?


#2

You can use the tagger field which is a GitActor which holds date field :

The timestamp of the Git action (authoring or committing).

{
  repository(owner: "peercoin", name: "peercoin") {
    tags: refs(refPrefix: "refs/tags/", last: 30) {
      edges {
        tag: node {
          name
          target {
            ... on Tag {
              commitUrl
              message
              tagger {
                name
                email
                date
              }
            }
          }
        }
      }
    }
  }
}

Try it in the explorer


#3

There is something wrong since the date field is returning the date from a commit, while the release date is totally different.

Example bellow: (released 2017-11-07 but GraphQL returns 2012-05-04).


#4

In fact you can query only the release tags with all metadata using releases and use the publishedAt field:

{
  repository(owner: "peercoin", name: "peercoin") {
    releases(last: 30) {
      edges {
        node {
          name
          publishedAt
          tag {
            name
          }
        }
      }
    }
  }
}

GraphQL API returns wrong releases
#5

It worked almost perfectly! The only downside is that this is only showing the last two releases, instead of all the available releases as the other queries showed.

I’ve tried some different approaches to make them appear again, but failed miserably.

Do you have any guess as to why that happens?

You can check the Explorer here.