behaviorbot / sentiment-bot

Replies to toxic comments with a maintainer designated reply and a link to the repo's code of conduct
https://github.com/apps/sentiment-bot
MIT License
83 stars 12 forks source link

Using the node-github accept header #8

Closed hiimbex closed 7 years ago

hiimbex commented 7 years ago

So basically this bot depends on these changes: https://github.com/mikedeboer/node-github/pull/555. Right now I've simply replace it in my node_modules, but that won't work when this gets deployed, so I'm not sure what's the best option.

The only line I truly need from my PR is the accept header here. According to some of their docs I can add an accept header when I instantiate the GitHub API; unfortunately, probot does the work on that end.

Options:

  1. Update probot's node-github handling to allow additional accept headers
  2. Don't use context.github and authenticate through node-github directly in my bot and pin my branch in the package.json
  3. Beg @zeke to merge my PR 😆

Thoughts @bkeepers?

bkeepers commented 7 years ago

I think you can pass headers in the request:

context.github.things.doTheThing({
  headers: {
    Accept: "application/vnd.github.scarlet-witch-preview+json"
  }
});

https://github.com/mikedeboer/node-github#example

hiimbex commented 7 years ago

Wow. So the moral of this story is, I never even need to open that node-github pull request and I could've done this from the very beginning. pats self on back 🙃

bkeepers commented 7 years ago

Wow. So the moral of this story is, I never even need to open that node-github pull request and I could've done this from the very beginning. pats self on back 🙃

or: if I had been paying closer attention to what you were trying to accomplish, I could have been helpful months ago.