Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 3
Message 1 of 2

API v4: releaseAssets connection of a search is randomly empty

Solved! Go to Solution.

Search repository, then fetch releaseAssets of releases in one query.

query MySearch($queryString: String!, $after: String, $first: Int) {
  search(query: $queryString, type: REPOSITORY, first: $first, after: $after) {
    pageInfo {
      startCursor
      hasNextPage
      endCursor
    }
    repositoryCount
    edges {
      node {
        ... on Repository {
          id
          name
          nameWithOwner
          releases(last: 10, orderBy: {field: CREATED_AT, direction: DESC}) {
            totalCount
            edges {
              node {
                tagName
                url
                isPrerelease
                isDraft
                publishedAt
                releaseAssets(first: 10) {
                  totalCount
                  edges {
                    node {
                      name
                      size
                      url
                      downloadUrl
                      downloadCount
                      contentType
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  rateLimit {
    limit
    cost
    remaining
    resetAt
  }
}

variables:

{ "first": 1, "after": null, "queryString": "net.peeweek.console language:c# sort:stars stars:2..1000000" }

In the example, all releases have release assets: https://github.com/peeweek/net.peeweek.console/releases

However the query result shows first two (v1.0.1-preview, 1.0.0-preview) without release assets.

 

{
  "data": {
    "search": {
      "pageInfo": {
        "startCursor": "Y3Vyc29yOjE=",
        "hasNextPage": false,
        "endCursor": "Y3Vyc29yOjE="
      },
      "repositoryCount": 1,
      "edges": [
        {
          "node": {
            "id": "MDEwOlJlcG9zaXRvcnkxMzA5MTQ5NjY=",
            "name": "net.peeweek.console",
            "nameWithOwner": "peeweek/net.peeweek.console",
            "releases": {
              "totalCount": 4,
              "edges": [
                {
                  "node": {
                    "tagName": "1.0.1-preview",
                    "url": "https://github.com/peeweek/net.peeweek.console/releases/tag/1.0.1-preview",
                    "isPrerelease": false,
                    "isDraft": false,
                    "publishedAt": "2019-04-10T12:29:06Z",
                    "releaseAssets": {
                      "totalCount": 0,
                      "edges": []
                    }
                  }
                },
                {
                  "node": {
                    "tagName": "1.0.0-preview",
                    "url": "https://github.com/peeweek/net.peeweek.console/releases/tag/1.0.0-preview",
                    "isPrerelease": false,
                    "isDraft": false,
                    "publishedAt": "2019-01-15T13:11:10Z",
                    "releaseAssets": {
                      "totalCount": 0,
                      "edges": []
                    }
                  }
                },
                {
                  "node": {
                    "tagName": "v0.02",
                    "url": "https://github.com/peeweek/net.peeweek.console/releases/tag/v0.02",
                    "isPrerelease": false,
                    "isDraft": false,
                    "publishedAt": "2018-04-24T22:07:56Z",
                    "releaseAssets": {
                      "totalCount": 2,
                      "edges": [
                        {
                          "node": {
                            "name": "Console_0.02.unitypackage",
                            "size": 47093,
                            "url": "https://github-production-release-asset-2e65be.s3.amazonaws.com/130914966/92b3073c-481c-11e8-95e9-b24439f81ffb?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190719%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190719T150756Z&X-Amz-Expires=300&X-Amz-Signature=85cdc7c20557f800f0e4f7a2d38988fdb9275fdf244203a1bfb7b2dd47679b79&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3DConsole_0.02.unitypackage&response-content-type=application%2Foctet-stream",
                            "downloadUrl": "https://github.com/peeweek/net.peeweek.console/releases/download/v0.02/Console_0.02.unitypackage",
                            "downloadCount": 2,
                            "contentType": "application/octet-stream"
                          }
                        },
                        {
                          "node": {
                            "name": "Console-0.02-TestBuild.zip",
                            "size": 14218992,
                            "url": "https://github-production-release-asset-2e65be.s3.amazonaws.com/130914966/99534e80-481c-11e8-805f-4ee5ef88d6d8?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190719%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190719T150756Z&X-Amz-Expires=300&X-Amz-Signature=4bf85ec4964b84be5a7a5ab7020add476d86f49e040014c0099cfba62c3b186e&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3DConsole-0.02-TestBuild.zip&response-content-type=application%2Foctet-stream",
                            "downloadUrl": "https://github.com/peeweek/net.peeweek.console/releases/download/v0.02/Console-0.02-TestBuild.zip",
                            "downloadCount": 3,
                            "contentType": "application/x-zip-compressed"
                          }
                        }
                      ]
                    }
                  }
                },
                {
                  "node": {
                    "tagName": "v0.01",
                    "url": "https://github.com/peeweek/net.peeweek.console/releases/tag/v0.01",
                    "isPrerelease": false,
                    "isDraft": false,
                    "publishedAt": "2018-04-24T21:20:49Z",
                    "releaseAssets": {
                      "totalCount": 2,
                      "edges": [
                        {
                          "node": {
                            "name": "Console_0.01.unitypackage",
                            "size": 46902,
                            "url": "https://github-production-release-asset-2e65be.s3.amazonaws.com/130914966/0e31e6c8-4816-11e8-8d3b-ad08fa917e16?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190719%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190719T150756Z&X-Amz-Expires=300&X-Amz-Signature=bc8bf053b312bb6c9029b9f6bc1552c02c0a9dddee18869ec51394747150dad8&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3DConsole_0.01.unitypackage&response-content-type=application%2Foctet-stream",
                            "downloadUrl": "https://github.com/peeweek/net.peeweek.console/releases/download/v0.01/Console_0.01.unitypackage",
                            "downloadCount": 0,
                            "contentType": "application/octet-stream"
                          }
                        },
                        {
                          "node": {
                            "name": "Console-0.01-TestBuild.zip",
                            "size": 14218617,
                            "url": "https://github-production-release-asset-2e65be.s3.amazonaws.com/130914966/6df18988-4816-11e8-8800-42a505a9b2f7?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190719%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190719T150756Z&X-Amz-Expires=300&X-Amz-Signature=385b7fe043e81bf6699a0eeeb1d3ebc4a70cec8b66ccc710ce61926addbcca5f&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3DConsole-0.01-TestBuild.zip&response-content-type=application%2Foctet-stream",
                            "downloadUrl": "https://github.com/peeweek/net.peeweek.console/releases/download/v0.01/Console-0.01-TestBuild.zip",
                            "downloadCount": 0,
                            "contentType": "application/x-zip-compressed"
                          }
                        }
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    },
    "rateLimit": {
      "limit": 5000,
      "cost": 1,
      "remaining": 4999,
      "resetAt": "2019-07-19T16:07:56Z"
    }
  }
}

 

It sounds a bug?

 

 

1 Reply
Solution
Copilot Lvl 3
Message 2 of 2

Re: API v4: releaseAssets connection of a search is randomly empty

Oh, my bad. Source code.zip are not considered as releaseAssets.