GitHub APIを使って色々してみようと思うので使い方についてのメモ。あくまでメモ。
現時点ではv3が最新のようです。
前提
GitHubで「Personal access tokens」からrepoに対して操作可能なTokenを取得しておく。
※追記:repo操作権限なくても大丈夫でした。
GitHub APIリファレンス
List pull requests(PRの一覧を取得)
Get a single pull request(個別PRを取得)
実行してみる
Pull Request一覧の取得
curl https://api.github.com/repos/kz800/hoge/pulls?access_token=xxxxx&state=open
個別のPull Requestの取得
curl https://api.github.com/repos/kz800/hoge/pulls/1?access_token=xxxxx&state=open
一旦これが動作するところまで確認できた。
パラメーターはAPIリファレンスにあるように他にもあるので試してみたい。
Tokenはリクエストヘッダに指定することも可能
curl -H "Authorization: token xxxxx" https://api.github.com/repos/kz800/hoge/pulls?state=open