pr-review-comments

作成者: microsoft

GitHubにインラインPRレビューコメントを送信・投稿するためのガイドです。プルリクエストの特定の行にコードレビューコメントを投稿する必要がある場合に使用します。

npx skills add https://github.com/microsoft/semantic-link-labs --skill pr-review-comments

Posting Inline PR Review Comments to GitHub

This skill documents how to post inline review comments to GitHub Pull Requests using the GitHub CLI (gh) and GitHub API. Inline comments appear directly on specific lines of code in the PR diff, making it easier for PR authors to identify and address issues.

When to Use This Skill

Use this skill when you need to:

  • Post inline review comments on specific lines of a PR
  • Automate code review feedback with targeted comments
  • Submit batch review comments via the GitHub API

Prerequisites

  1. GitHub CLI installed: Check with gh --version

    • If not installed on Linux:
      curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
      sudo chmod go+r /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 -y
      
  2. GitHub CLI authenticated: Check with gh auth status

    • If not authenticated: gh auth login -h github.com -p https --web
    • Follow the device code flow to complete authentication

Method: Using GitHub API with JSON Payload

Step 1: Get the PR's Head Commit SHA

COMMIT_SHA=$(gh api repos/{OWNER}/{REPO}/pulls/{PR_NUMBER} --jq '.head.sha')
echo "Commit SHA: $COMMIT_SHA"

Step 2: Create the Review JSON Payload

Create a JSON file with the review comments. Each comment needs:

  • path: The file path relative to repository root
  • line: The line number in the new version of the file (right side of diff)
  • body: The comment content (supports Markdown)
cat > /tmp/review.json << 'EOF'
{
  "commit_id": "YOUR_COMMIT_SHA_HERE",
  "event": "COMMENT",
  "comments": [
    {
      "path": "src/path/to/file.py",
      "line": 40,
      "body": "🔴 **Critical:** Description of the issue.\n\n**Suggested fix:**\n```python\n# your code here\n```"
    },
    {
      "path": "src/path/to/another_file.py",
      "line": 21,
      "body": "🟡 **Minor:** Another issue description."
    }
  ]
}
EOF

Step 3: Post the Review

gh api repos/{OWNER}/{REPO}/pulls/{PR_NUMBER}/reviews --method POST --input /tmp/review.json

Important Notes

Line Numbers

  • The line field refers to the line number in the new version of the file (right side of the diff)
  • For deleted lines, use side: "LEFT" and the line number from the old version
  • Make sure the line number exists in the diff, otherwise the API will reject the comment

Event Types

EventDescription
"COMMENT"Just add comments without approving/requesting changes
"APPROVE"Approve the PR with comments
"REQUEST_CHANGES"Request changes with comments

Comment Body Formatting

  • Supports full GitHub Markdown
  • Use \n for newlines in JSON
  • Escape special characters properly
  • Use emoji prefixes for severity: 🔴 Critical/High, 🟡 Medium/Minor, 🟢 Suggestion

Multi-line Comments

For commenting on a range of lines:

{
  "path": "src/file.py",
  "start_line": 10,
  "line": 15,
  "body": "This comment spans lines 10-15"
}

Troubleshooting

IssueSolution
"Validation Failed" errorCheck that the line number exists in the PR diff; verify the file path is correct
"Resource not accessible" errorEnsure you have write access to the repository; re-authenticate with gh auth login
Comments not appearing on specific linesThe line must be part of the diff (added, modified, or within context lines)

Alternative: Using gh pr review Command

For simpler reviews without inline comments:

gh pr review {PR_NUMBER} --repo {OWNER}/{REPO} --comment --body "Your review comment here"

This posts a general review comment but does not support inline comments on specific lines.


Repository-Specific Information

  • Repository: microsoft/semantic-link-labs
  • Common file paths:
    • src/sempy_labs/{module}/_items.py
    • src/sempy_labs/{module}/__init__.py
  • Review comment conventions:
    • Use severity emojis: 🔴 Critical, 🟡 Medium, 🟢 Minor
    • Include "Suggested fix" with code blocks
    • Reference specific line numbers

Examples

See the examples/ folder for complete working scripts:

microsoftのその他のスキル

oss-growth
microsoft
OSS成長ハッカーのペルソナ
official
microsoft-foundry
microsoft
Foundryエージェントのエンドツーエンドでのデプロイ、評価、管理:Dockerビルド、ACRプッシュ、ホスト型/プロンプトエージェント作成、コンテナ起動、バッチ評価、継続的評価、プロンプト最適化ワークフロー、agent.yaml、トレースからのデータセットキュレーション。用途:エージェントをFoundryにデプロイ、ホスト型エージェント、エージェント作成、エージェント呼び出し、エージェント評価、バッチ評価実行、継続的評価、継続的モニタリング、継続的評価ステータス、プロンプト最適化、プロンプト改善、プロンプトオプティマイザー、エージェント指示最適化、エージェント改善...
officialdevelopmentdevops
azure-ai
microsoft
Azure AI向けに使用:Search、Speech、OpenAI、Document Intelligence。検索、ベクター/ハイブリッド検索、音声認識、音声合成、文字起こし、OCRを支援。使用時:AI Search、クエリ検索、ベクター検索、ハイブリッド検索、セマンティック検索、音声認識、音声合成、文字起こし、OCR、テキスト読み上げ。
officialdevelopmentapi
azure-deploy
microsoft
既存の.azure/deployment-plan.mdとインフラストラクチャファイルを持つ、すでに準備済みのアプリケーションに対してAzureデプロイを実行します。ユーザーが新しいアプリケーションの作成を依頼した場合はこのスキルを使用せず、代わりにazure-prepareを使用してください。このスキルは、azd up、azd deploy、terraform apply、az deploymentコマンドを組み込みのエラーリカバリ機能付きで実行します。azure-prepareからの.azure/deployment-plan.mdと、azure-validateからの検証済みステータスが必要です。使用タイミング:「azd upを実行」、「azd deployを実行」、「デプロイを実行」...
officialdevopsaws
azure-storage
microsoft
Azure Storage Servicesには、Blob Storage、File Shares、Queue Storage、Table Storage、Data Lakeが含まれます。ストレージアクセス層(ホット、クール、コールド、アーカイブ)について、各層の使用タイミングや比較に関する質問に回答します。オブジェクトストレージ、SMBファイル共有、非同期メッセージング、NoSQLキーバリュー、ビッグデータ分析を提供します。ライフサイクル管理を含みます。使用用途:ブロブストレージ、ファイル共有、キューストレージ、テーブルストレージ、データレイク、ファイルアップロード、ブロブダウンロード、ストレージアカウント、アクセス層、...
officialdevelopmentdatabase
azure-diagnostics
microsoft
Azure上でAppLens、Azure Monitor、リソースヘルス、安全なトリアージを使用して、Azureの本番環境の問題をデバッグします。使用時:本番環境の問題のデバッグ、App Serviceのトラブルシューティング、App Serviceの高CPU、App Serviceのデプロイ障害、コンテナアプリのトラブルシューティング、Functionsのトラブルシューティング、AKSのトラブルシューティング、kubectlが接続できない、kube-system/CoreDNSの障害、PodがPending状態、CrashLoop、ノードがReadyにならない、アップグレード障害、ログの分析、KQL、インサイト、イメージプル障害、コールドスタート問題、ヘルスプローブ障害、...
officialdevopsdevelopment
azure-prepare
microsoft
Azureアプリのデプロイ準備(インフラBicep/Terraform、azure.yaml、Dockerfiles)。新規作成/モダナイズ、または作成+デプロイに使用。クロスクラウド移行には非対応(azure-cloud-migrateを使用)。使用禁止:copilot-sdkアプリ(azure-hosted-copilot-sdkを使用)。対象:「アプリ作成」「Webアプリ構築」「API作成」「サーバーレスHTTP API作成」「フロントエンド作成」「バックエンド作成」「サービス構築」「アプリケーションのモダナイズ」「アプリケーション更新」「認証追加」「キャッシュ追加」「Azureへのホスティング」「作成および...」
officialdevelopmentdevops
azure-validate
microsoft
Azureへの準備が整っているかを確認するためのデプロイ前検証。構成、インフラストラクチャ(BicepまたはTerraform)、RBACロールの割り当て、マネージドIDの権限、前提条件について詳細なチェックを実行します。使用場面:アプリの検証、デプロイ準備状況の確認、事前チェックの実行、構成の確認、デプロイ可能かの確認、azure.yamlの検証、Bicepの検証、デプロイ前のテスト、デプロイエラーのトラブルシューティング、Azure Functionsの検証、関数アプリの検証、サーバーレスの検証...
officialdevopstesting