build-canaries / nevergreen

:baby_chick: A build monitor with attitude
https://nevergreen.io
Eclipse Public License 1.0
215 stars 38 forks source link

Use GitHub v4 API #277

Closed GentlemanHal closed 5 years ago

GentlemanHal commented 5 years ago

We currently use v3 of the API to create Gists for backups.

Although its unlikely v3 is going to be removed anytime soon it would be nice to update to use v4. If I understand correctly it uses GraphQL so we could request just the data we require.

This would also be a good opportunity to make the GitHub API calls server side (if this is implemented before #278).

GentlemanHal commented 5 years ago

Playing around with the Graph Explorer I was able to create a query that returned the gist data (I've never used GraphQL before so no idea if this is the correct / best way):

{
  viewer {
    gist(name: "some-id") {
      description
      files {
        name
        encoding
        isTruncated
        text
      }
    }
  }
}

It appears you can't get the raw_url of the gist using v4, which means it wouldn't be possible to get truncated configuration. This shouldn't actually be a problem as the config is unlikely to get large enough to be truncated (>10megs), but given this works in v3 it makes switching less palatable.

Also the returned data isn't that much less and might actually be more of a pain to parse.

Given this I'm going to mark this as low priority. I'm not going to close it, as I only played around a little bit and might be missing something.

joejag commented 5 years ago

I've not used GraphQL either, but that looks pretty cool.

I agree with the delay, I imagine GitHub will support the truncation stuff eventually before turning off v3.

GentlemanHal commented 5 years ago

There doesn't seem to be any point in leaving this in our list of open issues, as realistically we aren't going to be doing anything about this until GitHub decided to drop support for v3.