Get Latest Release and Get Archive Link missing?

community-help

#1

I’m trying to figure out how to do either of these things with the latest graphql:

Get Latest Release
https://developer.github.com/v3/repos/releases/#get-the-latest-release

Get Archive Link
https://developer.github.com/v3/repos/contents/#get-archive-link


Additionally TIL the difference between an asset and an archive:

And I know this is the wrong place to raise the issue, but here we are.


How to find the zipball url for a release by specifying it's tag?
#2

:wave: @flyinprogrammer,

I think this query may be what you’re looking for:

query($owner:String!,$name:String!) {
  repository(owner:$owner,name:$name) {
    releases(last:1,orderBy:{field:CREATED_AT,direction:DESC}) {
      edges {
        node {
          url
          releaseAssets(last:100) {
            edges {
              node {
                downloadUrl
              }
            }
          }
          tag {
            name
            target {
              ... on Commit {
                zipballUrl
                tarballUrl
              }
            }
          }
        }
      }
    }
  }
}

Which, with these variables:

{
  "owner": "bswinnerton",
  "name": "launchbar-github"
}

Would return:

{
  "data": {
    "repository": {
      "releases": {
        "edges": [
          {
            "node": {
              "url": "https://github.com/bswinnerton/launchbar-github/releases/tag/v0.1.0",
              "releaseAssets": {
                "edges": [
                  {
                    "node": {
                      "downloadUrl": "https://github.com/bswinnerton/launchbar-github/releases/download/v0.1.0/github.lbaction.zip"
                    }
                  }
                ]
              },
              "tag": {
                "name": "v0.1.0",
                "target": {
                  "zipballUrl": "https://codeload.github.com/bswinnerton/launchbar-github/legacy.zip/e220646e02cbf12e9f7bfda4ce4e1bfa6403913e",
                  "tarballUrl": "https://codeload.github.com/bswinnerton/launchbar-github/legacy.tar.gz/e220646e02cbf12e9f7bfda4ce4e1bfa6403913e"
                }
              }
            }
          }
        ]
      }
    }
  }
}

As you can see the zipballUrl and tarballUrl live on the underlying Commit object of the tag for a given release.

I hope this helps,
Brooks