0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GitHub CLIでプライベートリポジトリのプルリクエストコメントを効率的に抽出する

Posted at

はじめに

GitHubは、開発者にとって不可欠なツールであり、その多機能性は日々の作業を大いに助けてくれます。特にGitHub CLIは、コマンドラインを通じてGitHubの操作を行う強力なツールです。今回は、GitHub CLIを使用してプライベートリポジトリからプルリクエストのコメントを抽出する方法を紹介します。

GitHub CLIのセットアップ

GitHub CLIを使用する前に、適切な認証が必要です。以下のコマンドでログインできます(今回は HTTPS で認証を通して、ブラウザで認証しています)

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: 1234-5678
Press Enter to open github.com in your browser... 
既存のブラウザ セッションで開いています。
✓ Authentication complete.
- gh config set -h github.com git_protocol https
✓ Configured git protocol
✓ Logged in as developer

プルリクエストのコメントを抽出

特定のプルリクエストのコメントを表示するには、以下のコマンドを使用します

gh pr view <PR_NUMBER> --comments

**<PR_NUMBER>**は対象のプルリクエスト番号に置き換えてください。

実際のコメント抽出例

例として、プルリクエスト番号386のコメントを抽出した場合の出力は以下のようになります(企業名、プロジェクト名、個人名は架空のものに置き換えています)

gh pr view 386 --comments
オンラインストア ギフト履歴一覧 API 実装 #386
Merged • developer-a wants to merge 22 commits into main from feature/online-store-gift-list • about 1 day ago
+487 -247 • ✓ Checks passing
Reviewers: reviewer-a (Approved)
Assignees: developer-a

  ## チケットへのリンク

  • &#8203;``【oaicite:1】``&#8203;&#8203;``【oaicite:0】``&#8203;オンラインストア ギフト履歴一覧 API 実装
  https://www.example-link.com/online-store-api

  ## やったこと

  • テスト追加
  • リファクタリング

  ## やらないこと

  • この Pull Requestでやらないことは何か?

  ## できるようになること(利用者目線)

  • ギフト履歴が閲覧可能

  ## できなくなること(利用者目線)

  • 特になし

  ## 動作確認

  • 全てのテストにパスする
  • ローカルでギフト履歴が閲覧可能

  ## その他

  • レビュワーへの参考情報

reviewer-a commented (Contributor) • 1d

  @developer-a

  lintの問題があります。修正をお願いします。

developer-a (Collaborator) • 1d
1 👍

  @reviewer-a
  修正しました。ありがとうございます!

View the full review: https://github.com/example-company/online-store-api/pull/386#issuecomment-1234567890

reviewer-a (Contributor) • 1d

  │ @developer-a
  │ 修正ありがとうございます!

  lintの問題が解決しました。

View the full review: https://github.com/example-company/online-store-api/pull/386#issuecomment-1234567891

developer-a (Collaborator) • 1d
1 👍

  最新のコードを取り込み、lintエラーを修正しました!

View the full review: https://github.com/example-company/online-store-api/pull/386#issuecomment-1234567892

reviewer-a (Contributor) • 1d
1 👍

  │ 修正ありがとうございます!

  lintが改善され、レビューが容易になりました。

View the full review: https://github.com/example-company/online-store-api/pull/386#issuecomment-1234567893

reviewer-a approved (Contributor) • 1d • Newest comment

  👍

View this pull request on GitHub: https://github.com/example-company/online-store-api/pull/386

まとめ

GitHub CLIは、GitHubの操作をコマンドラインから行う強力なツールです。特にプライベートリポジトリのプルリクエストのコメントを抽出する機能は、コードレビューやプロジェクトの進行状況の追跡に非常に便利です。この記事が、GitHub CLIの活用方法を理解する一助となれば幸いです

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?