雑なメモ

学びを記す

GitHub APIの認証

gemがある。
octokit/octokit.rb

gemインストール

gem install octokit

認証

client = Octokit::Client.new login: "ユーザ名", password: "パスワード"

2段階認証している場合

token = client.create_authorization( scopes: ["user","repo"],
                                     note: "token名(任意)",
                                     headers: { "X-GitHub-OTP" => "2FA_token" } )
client = Octokit::Client.new access_token: "token[:token]"

scopesのこと

issueを取ってくる

client.issues 'ユーザ名/リポジトリ名'