Get latest release/prerelease


#1

How can I get the latest full release and the latest prerelease?

For example I have this to get the first and last release:

query ($owner: String!, $repo: String!) {
  repository(owner: $owner, name: $repo) {
    lastRelease: releases(last: 1) {
      ...releaseData
    }
    firstRelease: releases(first: 1) {
      ...releaseData
    }
  }
}

fragment releaseData on ReleaseConnection {
  nodes {
    name
    isPrerelease
    tag {
      name
    }
  }
}

But instead I would like to get both the last release marked as isPrerelease and the last not marked as isPrerelease. Is that at all possible?


#2

Hey @tduva,

Unfortunately there isn’t a way to do this right now. The best way would probably be to query for releases and then do client-side filtering on the list.

We had another feature request for better filtering on this connection, which would likely allow for a better way to do this. I’ll be sure to let you know when this ships!