Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 09:08:16 +08:00
commit fc569e5620
38 changed files with 4997 additions and 0 deletions

View 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)
"'