Initial commit
This commit is contained in:
28
skills/github-pr-workflow/scripts/gh-pr-review-comments
Executable file
28
skills/github-pr-workflow/scripts/gh-pr-review-comments
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# Get inline code review comments from a GitHub PR
|
||||
# Usage: gh-pr-review-comments <PR_NUMBER> [REPO]
|
||||
#
|
||||
# If REPO is not provided, uses the current git remote origin
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
PR_NUMBER="${1:?Usage: gh-pr-review-comments <PR_NUMBER> [REPO]}"
|
||||
REPO="${2:-}"
|
||||
|
||||
# If no repo provided, try to detect from git remote
|
||||
if [[ -z "$REPO" ]]; then
|
||||
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner' 2>/dev/null || true)
|
||||
if [[ -z "$REPO" ]]; then
|
||||
echo "Error: Could not detect repo. Provide REPO as second argument (e.g., owner/repo)" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
gh api "repos/${REPO}/pulls/${PR_NUMBER}/comments" | jq -r '
|
||||
.[] |
|
||||
"───────────────────────────────────────────────────────────────────────
|
||||
File: \(.path):\(.line // .original_line // "N/A")
|
||||
Author: \(.user.login) (\(.created_at | split("T")[0]))
|
||||
───────────────────────────────────────────────────────────────────────
|
||||
\(.body)
|
||||
"'
|
||||
Reference in New Issue
Block a user