jekyll / Utterson

CI benchmarking suite for Jekyll
MIT License
13 stars 8 forks source link

Use Octokit to generate installation access token #60

Closed ashmaroli closed 6 years ago

ashmaroli commented 6 years ago

Closes #‌21

In theory, this should be all that's required, though I do not see how one can reliably test this..

pathawks commented 6 years ago

This doesn't quite close #21; we still have github/checks/* to transition to Octokit, but this is great :+1:

This does output the following message to stderr, but I don't think that should be a problem:

WARNING: The preview version of the Integrations API is not yet suitable for production use.
You can avoid this message by supplying an appropriate media type in the 'Accept' request
header.
ashmaroli commented 6 years ago

This doesn't quite close #21;

I see. Can you please edit the issue to have "tasks" in it..? One each for github/checks/* and another completed task for token..? Also, the has-pull-request label on the issue has to be removed..

ashmaroli commented 6 years ago

I don't see a dedicated module to allow Octokit send requests to the Checks API, nor do I see an Issue / PR at the Octokit Repo to have one. So not sure what the best approach here would be. /cc @parkr @mattr-

(FWIW, For my own test app, I was able to successfully patch Octokit to send requests to the Checks endpoints.)

mattr- commented 6 years ago

We haven’t updated Octokit yet for the new Checks API since it’s still in beta. Your best bet is to make post calls directly with Octokit. Octokit.post or similar should do the trick. On Fri, Jul 27, 2018 at 11:22 PM Ashwin Maroli notifications@github.com wrote:

I don't see a dedicated module to allow Octokit send requests to the Checks API, nor do I see an Issue / PR at the Octokit Repo to have one. So not sure what the best approach here would be. /cc @parkr https://github.com/parkr @mattr- https://github.com/mattr-

(FWIW, For my own test app, I was able to successfully patch Octokit to send requests to the Checks endpoints.)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jekyll/Utterson/pull/60#issuecomment-408581491, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEtdkv6Vo0K9pRblhgQ-0FcHAZwWnIUks5uK-cCgaJpZM4VkPAT .

ashmaroli commented 6 years ago

We haven’t updated Octokit yet for the new Checks API since it’s still in beta.

Thank you @mattr-. I had a hunch that this would be the reason..

Your best bet is to make post calls directly with Octokit.

@pathawks Would having the following code in Utterson be welcome..?

module Octokit
  class Client
    PREVIEW_HEADER = {
      :headers => {
        "Accept" => "application/vnd.github.antiope-preview+json"
      }
    }

    def create_check_run(repo, data)
      options = data.merge(PREVIEW_HEADER)
      post "#{Repository.path repo}/check-runs", options
    end

    def update_check_run(repo, id, data)
      options = data.merge(PREVIEW_HEADER)
      patch "#{Repository.path repo}/check-runs/#{id}", options
    end
  end
end