Open5
GitHub CLIに入門してみるゾウ
きほん
参考
GitHub CLI 公式
公式リポジトリ
GitHub CLIで始める快適GitHub生活 | Qiita
GitHub CLI を使ってみた | developersIO
GitHub CLI いず 何?
GitHubの操作を行えるCLIツール
gh is GitHub on the command line. It brings pull requests, issues, and other GitHub concepts to the terminal next to where you are already working with git and your code.
何が嬉しいの?
セットアップ
インストール
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh
バージョン確認
[kumamoto ~]$ which gh
/usr/bin/gh
[kumamoto ~]$ gh --version
gh version 2.5.1 (2022-02-15)
https://github.com/cli/cli/releases/tag/v2.5.1
認証
[kumamoto ~]$ gh auth login
? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations? HTTPS
? Authenticate Git with your GitHub credentials? Yes
? How would you like to authenticate GitHub CLI? Login with a web browser
! First copy your one-time code: xxxx-xxxx
Press Enter to open github.com in your browser...
既存のブラウザ セッションで開いています。
Webブラウザで認証
[19715:19715:0100/000000.560516:ERROR:sandbox_linux.cc(377)] InitializeSandbox() called with multiple threads in process gpu-process.
✓ Authentication complete.
- gh config set -h github.com git_protocol https
✓ Configured git protocol
✓ Logged in as Kumamoto-Hamachi
確認
[kumamoto ~]$ gh auth status
github.com
✓ Logged in to github.com as Kumamoto-Hamachi (/home/kumamoto/.config/gh/hosts.yml)
✓ Git operations for github.com configured to use https protocol.
✓ Token: *******************
基本設定
コマンド保管
基本的な使い方
issue の取得
$ gh issue list
PR 一覧の取得
$ gh pr list
自分のプルリクの検索
-- myprでエイリアスとして登録
$ gh alias set mypr "pr list -s all -a Kumamoto(ユーザー名)"
-- 検索の実行
$ gh mypr | grep "ほげほげ"
最新リリースの取得 TODO
$ gh release view
ワークフローの実行 TODO
?
その他
ghp