Markdown Cleanup Github Bot: Difference between revisions
From charlesreid1
| Line 39: | Line 39: | ||
example here: https://github.com/yiisoft-contrib/github-bot | example here: https://github.com/yiisoft-contrib/github-bot | ||
* this uses a "register" and "unregister" action model | * this uses a "register" and "unregister" action model | ||
* it does use the API to install hooks into a repo | * it does use the API to install hooks into a repo | ||
Revision as of 01:31, 5 August 2018
MCBot = Markdown Cleanup Github Bot
Notes
In Theory
Here's how this thing works, in theory anyway:
- First, you set up a Github bot account - the user that will do your bidding.
- Next, you create a Github OAuth account as that user. This OAuth application will ask users for various permissions. One of those permissions is the ability to commit to repositories.
- This is still totally unclear.
How it works:
- Run the flask app somewhere (self-hosted, heroku, google app engine)
- Install a webhook in your repo that pings the endpoint, and only do on pull request events
Why I'm still confused:
- The OAuth application has an "owner" and it has "users"
- We're trying to build a bot that can comment on pull requests in private repositories
- Does the OAuth application simply need to request write permission for repos?
- Can the owner of the OAuth application then do what they'd like? Do the changes show up under the account of the OAuth application's owner?
In Practice
Let's try this out in practice.
I want to be able to mention @embarcaderomindmachine in an issues/PR thread, and get a response from @embarcaderomindmachine.
Simple enough - how do we get started?
@embarcaderomindmachine needs to be notified of events that are relevant. that means creating a webhook endpoint that is for embarcaderomindmachine, that is continuously listening, and when it receives webhoooks, it will take an action.
Questions
Ideally, a given oauth application would install itself as a webhook in your repository. I think that's possible to ask permission to do via API, but is this really how it needs to be done? Also what happens when you revoke permission? The webhook is still installed... right?
We should have a better way of automating this.
example here: https://github.com/yiisoft-contrib/github-bot
- this uses a "register" and "unregister" action model
- it does use the API to install hooks into a repo
- also (responsibly) implements an uninstall hooks method
Links
Useful: PR request hook (flask server) that comments on PRs from first-time contributors
Related
Also see DIY CI