Github Bot
Github Bot
Register Heroku
Local setting
pip install gidgethub
get your Github Token
In Unix / Mac OS:
export GH_AUTH=your token
Local test
import asyncio
import os
import aiohttp
from gidgethub.aiohttp import GitHubAPI
async def main():
async with aiohttp.ClientSession() as session:
gh = GitHubAPI(session, "krnick", oauth_token=os.getenv("GH_AUTH"))
# 開啟新的 issue
await gh.post('/repos/krnick/Github-Bot/issues',
data={
'title': 'Hello Nick',
'body': 'This is github bot from JunWei',
})
# 關閉 issue
await gh.patch('/repos/krnick/Github-Bot/issues/1',
data={'state': 'closed'},
)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
deploy
create a new APP

auth

connect Github




Creat a new webhook at the repo you want to build



Set your key at Heroku
GH_AUTH
GH_SECRET
typo check repos example







Ref
https://github-bot-tutorial.readthedocs.io/en/latest/index.html