pr-review-comments

Guía para enviar/publicar comentarios en línea de revisión de PR a GitHub. Úsala cuando necesites publicar comentarios de revisión de código en líneas específicas de una Solicitud de Extracción.

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:

Más skills de microsoft

oss-growth
microsoft
Persona de growth hacker de OSS
official
microsoft-foundry
microsoft
Implementar, evaluar y gestionar agentes de Foundry de extremo a extremo: compilación de Docker, envío a ACR, creación de agente alojado/de prompt, inicio de contenedor, evaluación por lotes, evaluación continua, flujos de trabajo del optimizador de prompts, agent.yaml, curación de conjuntos de datos a partir de trazas. USAR PARA: implementar agente en Foundry, agente alojado, crear agente, invocar agente, evaluar agente, ejecutar evaluación por lotes, evaluación continua, monitoreo continuo, estado de evaluación continua, optimizar prompt, mejorar prompt, optimizador de prompts, optimizar instrucciones del agente, mejorar agente...
officialdevelopmentdevops
azure-ai
microsoft
Útil para Azure AI: Search, Speech, OpenAI, Document Intelligence. Ayuda con búsqueda, búsqueda vectorial/híbrida, voz a texto, texto a voz, transcripción, OCR. CUANDO: AI Search, búsqueda de consultas, búsqueda vectorial, búsqueda híbrida, búsqueda semántica, voz a texto, texto a voz, transcribir, OCR, convertir texto a voz.
officialdevelopmentapi
azure-deploy
microsoft
Ejecuta despliegues en Azure para aplicaciones YA PREPARADAS que tengan archivos .azure/deployment-plan.md e infraestructura existentes. NO uses esta habilidad cuando el usuario solicite CREAR una nueva aplicación — usa azure-prepare en su lugar. Esta habilidad ejecuta comandos azd up, azd deploy, terraform apply y az deployment con recuperación de errores integrada. Requiere .azure/deployment-plan.md de azure-prepare y estado validado de azure-validate. CUANDO: "ejecutar azd up", "ejecutar azd deploy", "ejecutar despliegue",...
officialdevopsaws
azure-storage
microsoft
Servicios de Azure Storage que incluyen Blob Storage, File Shares, Queue Storage, Table Storage y Data Lake. Responde preguntas sobre niveles de acceso de almacenamiento (hot, cool, cold, archive), cuándo usar cada nivel y comparación entre niveles. Proporciona almacenamiento de objetos, recursos compartidos de archivos SMB, mensajería asíncrona, NoSQL clave-valor y análisis de big data. Incluye gestión del ciclo de vida. USAR PARA: blob storage, file shares, queue storage, table storage, data lake, subir archivos, descargar blobs, cuentas de almacenamiento, niveles de acceso,...
officialdevelopmentdatabase
azure-diagnostics
microsoft
Depura problemas de producción en Azure usando AppLens, Azure Monitor, estado de recursos y triaje seguro. CUANDO: depurar problemas de producción, solucionar problemas de App Service, CPU alta en App Service, fallo de implementación de App Service, solucionar problemas de Container Apps, solucionar problemas de Functions, solucionar problemas de AKS, kubectl no puede conectar, fallos de kube-system/CoreDNS, pod pendiente, crashloop, nodo no listo, fallos de actualización, analizar registros, KQL, información, fallos de extracción de imágenes, problemas de arranque en frío, fallos de sondeo de estado,...
officialdevopsdevelopment
azure-prepare
microsoft
Prepara aplicaciones de Azure para el despliegue (infra Bicep/Terraform, azure.yaml, Dockerfiles). Úselo para crear/modernizar o crear+desplegar; no para migración entre nubes (use azure-cloud-migrate). NO USAR PARA: aplicaciones copilot-sdk (use azure-hosted-copilot-sdk). CUANDO: "crear aplicación", "construir aplicación web", "crear API", "crear API HTTP sin servidor", "crear frontend", "crear backend", "construir un servicio", "modernizar aplicación", "actualizar aplicación", "agregar autenticación", "agregar almacenamiento en caché", "alojar en Azure", "crear y...
officialdevelopmentdevops
azure-validate
microsoft
Validación previa al despliegue para la preparación en Azure. Realiza verificaciones exhaustivas de configuración, infraestructura (Bicep o Terraform), asignaciones de roles RBAC, permisos de identidad administrada y requisitos previos antes de desplegar. CUÁNDO: validar mi aplicación, verificar preparación para el despliegue, ejecutar comprobaciones previas, verificar configuración, comprobar si está listo para desplegar, validar azure.yaml, validar Bicep, probar antes de desplegar, solucionar errores de despliegue, validar Azure Functions, validar aplicación de funciones, validar serverless...
officialdevopstesting