Terminalからcurlでgithubのissueにコメントする – macOS

下記を打ち込むと

$ curl -u 'ユーザー名' -d '{"scopes":["repo"],"note":"Help example"}' https://api.github.com/authorizations

下記が出てくる

Enter host password for user 'ユーザー名':

パスワードを打つと、下記が出てくる。

{
"id": 240929928,
"url": "https://api.github.com/authorizations/240929928",
"app": {
"name": "Help example",
"url": "https://developer.github.com/v3/oauth_authorizations/",
"client_id": "00000000000000000000"
},
"token": "ここ使った",
"hashed_token": "692b79cfbcab3ふfウェfw26bd9fdfwfウェffaf0b37b",
"token_last_eight": "f2fウェfwえfwd",
"note": "Help example",
"note_url": null,
"created_at": "2018-11-30T07:37:08Z",
"updated_at": "2018-11-30T07:37:08Z",
"scopes": [
"repo"
],
"fingerprint": null
}

んで、これでターミナルからgithubのissueにコメントできる

curl -X POST -H 'Content-Type:application/json' -d "{\"body\":\"GitHub APIからコメント投稿\"}" https://api.github.com/repos/あなたのチーム/リポジトリ/issues/222/comments?access_token=ここ使った

 

藤沢瞭介(Ryosuke Hujisawa)
  • りょすけと申します。18歳からプログラミングをはじめ、今はフロントエンドでReactを書いたり、AIの勉強を頑張っています。off.tokyoでは、ハイテクやガジェット、それからプログラミングに関する情報まで、エンジニアに役立つ情報を日々発信しています!

未整理記事