Initial commit
This commit is contained in:
23
skills/github-pr-workflow/scripts/gh-pr-checks
Executable file
23
skills/github-pr-workflow/scripts/gh-pr-checks
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
# Get CI check status for a PR
|
||||
# Usage: gh-pr-checks <PR_NUMBER> [REPO]
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
PR_NUMBER="${1:?Usage: gh-pr-checks <PR_NUMBER> [REPO]}"
|
||||
REPO="${2:-}"
|
||||
|
||||
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" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Get the head SHA first
|
||||
HEAD_SHA=$(gh api "repos/${REPO}/pulls/${PR_NUMBER}" --jq '.head.sha')
|
||||
|
||||
gh api "repos/${REPO}/commits/${HEAD_SHA}/check-runs" | jq -r '
|
||||
.check_runs[] |
|
||||
"\(if .conclusion == "success" then "✓" elif .conclusion == "failure" then "✗" elif .status == "in_progress" then "⋯" else "?" end) \(.name): \(.conclusion // .status)"'
|
||||
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)
|
||||
"'
|
||||
21
skills/github-pr-workflow/scripts/gh-pr-reviews
Executable file
21
skills/github-pr-workflow/scripts/gh-pr-reviews
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
# Get review decisions (approved, changes_requested, commented) for a PR
|
||||
# Usage: gh-pr-reviews <PR_NUMBER> [REPO]
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
PR_NUMBER="${1:?Usage: gh-pr-reviews <PR_NUMBER> [REPO]}"
|
||||
REPO="${2:-}"
|
||||
|
||||
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" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
gh api "repos/${REPO}/pulls/${PR_NUMBER}/reviews" | jq -r '
|
||||
.[] |
|
||||
select(.state != "PENDING") |
|
||||
"\(.user.login): \(.state) (\(.submitted_at | split("T")[0]))\(if .body != "" then "\n \(.body)" else "" end)"'
|
||||
27
skills/github-pr-workflow/scripts/gh-pr-summary
Executable file
27
skills/github-pr-workflow/scripts/gh-pr-summary
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# Get a summary of a PR: title, body, state, and review status
|
||||
# Usage: gh-pr-summary <PR_NUMBER> [REPO]
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
PR_NUMBER="${1:?Usage: gh-pr-summary <PR_NUMBER> [REPO]}"
|
||||
REPO="${2:-}"
|
||||
|
||||
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" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
gh api "repos/${REPO}/pulls/${PR_NUMBER}" | jq -r '
|
||||
"PR #\(.number): \(.title)
|
||||
State: \(.state) | Mergeable: \(.mergeable // "unknown") | Draft: \(.draft)
|
||||
Author: \(.user.login)
|
||||
Branch: \(.head.ref) → \(.base.ref)
|
||||
Created: \(.created_at | split("T")[0])
|
||||
URL: \(.html_url)
|
||||
|
||||
─── Description ───
|
||||
\(.body // "(no description)")"'
|
||||
Reference in New Issue
Block a user