chore: import upstream snapshot with attribution
Upgrade checks / Notify on failure (push) Has been cancelled
Upgrade checks / Close issue on success (push) Has been cancelled
Schema Crash Test / Real-world schema crash test (232K schemas) (push) Has been cancelled
Run static analysis / static_analysis (push) Has been cancelled
Tests / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Tests / Tests with lowest-direct dependencies (push) Has been cancelled
Tests / MCP conformance tests (push) Has been cancelled
Tests / Integration tests (push) Has been cancelled
Tests / Package install smoke (push) Has been cancelled
Upgrade checks / Static analysis (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Upgrade checks / Integration tests (push) Has been cancelled
Update MCPServerConfig Schema / update-config-schema (push) Has been cancelled
Update SDK Documentation / update-sdk-docs (push) Has been cancelled
Upgrade checks / Notify on failure (push) Has been cancelled
Upgrade checks / Close issue on success (push) Has been cancelled
Schema Crash Test / Real-world schema crash test (232K schemas) (push) Has been cancelled
Run static analysis / static_analysis (push) Has been cancelled
Tests / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Tests / Tests with lowest-direct dependencies (push) Has been cancelled
Tests / MCP conformance tests (push) Has been cancelled
Tests / Integration tests (push) Has been cancelled
Tests / Package install smoke (push) Has been cancelled
Upgrade checks / Static analysis (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Upgrade checks / Integration tests (push) Has been cancelled
Update MCPServerConfig Schema / update-config-schema (push) Has been cancelled
Update SDK Documentation / update-sdk-docs (push) Has been cancelled
This commit is contained in:
+62
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Get PR review threads with comments via GitHub GraphQL API
|
||||
#
|
||||
# Usage:
|
||||
# gh-get-review-threads.sh [FILTER]
|
||||
#
|
||||
# Arguments:
|
||||
# FILTER - Optional: filter for unresolved threads from specific author
|
||||
#
|
||||
# Environment (set by composite action):
|
||||
# MENTION_REPO - Repository (owner/repo format)
|
||||
# MENTION_PR_NUMBER - Pull request number
|
||||
# GITHUB_TOKEN - GitHub API token
|
||||
#
|
||||
# Output:
|
||||
# JSON array of review threads with nested comments
|
||||
|
||||
# Parse OWNER and REPO from MENTION_REPO
|
||||
REPO_FULL="${MENTION_REPO:?MENTION_REPO environment variable is required}"
|
||||
OWNER="${REPO_FULL%/*}"
|
||||
REPO="${REPO_FULL#*/}"
|
||||
PR_NUMBER="${MENTION_PR_NUMBER:?MENTION_PR_NUMBER environment variable is required}"
|
||||
FILTER="${1:-}"
|
||||
|
||||
gh api graphql -f query='
|
||||
query($owner: String!, $repo: String!, $prNumber: Int!) {
|
||||
repository(owner: $owner, name: $repo) {
|
||||
pullRequest(number: $prNumber) {
|
||||
reviewThreads(first: 100) {
|
||||
nodes {
|
||||
id
|
||||
isResolved
|
||||
isOutdated
|
||||
path
|
||||
line
|
||||
comments(first: 50) {
|
||||
nodes {
|
||||
id
|
||||
body
|
||||
author { login }
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}' -F owner="$OWNER" \
|
||||
-F repo="$REPO" \
|
||||
-F prNumber="$PR_NUMBER" \
|
||||
--jq '.data.repository.pullRequest.reviewThreads.nodes' | \
|
||||
if [ -n "$FILTER" ]; then
|
||||
jq --arg author "$FILTER" '
|
||||
map(select(
|
||||
.isResolved == false and
|
||||
.comments.nodes | any(.author.login == $author)
|
||||
))'
|
||||
else
|
||||
cat
|
||||
fi
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Resolve a GitHub PR review thread, optionally posting a comment first
|
||||
#
|
||||
# Usage:
|
||||
# gh-resolve-review-thread.sh THREAD_ID [COMMENT]
|
||||
#
|
||||
# Arguments:
|
||||
# THREAD_ID - The GraphQL node ID of the review thread to resolve
|
||||
# COMMENT - Optional: Comment body to post before resolving
|
||||
#
|
||||
# Environment (set by composite action):
|
||||
# MENTION_REPO - Repository (owner/repo format)
|
||||
# MENTION_PR_NUMBER - Pull request number
|
||||
# GITHUB_TOKEN - GitHub API token
|
||||
#
|
||||
# Behavior:
|
||||
# 1. If COMMENT is provided, posts it as a reply to the thread
|
||||
# 2. Resolves the thread
|
||||
|
||||
# Validate required environment variables
|
||||
: "${MENTION_REPO:?MENTION_REPO environment variable is required}"
|
||||
: "${MENTION_PR_NUMBER:?MENTION_PR_NUMBER environment variable is required}"
|
||||
THREAD_ID="${1:?Thread ID required}"
|
||||
COMMENT="${2:-}"
|
||||
|
||||
# Step 1: Post comment if provided
|
||||
if [ -n "$COMMENT" ]; then
|
||||
echo "Posting comment to thread..." >&2
|
||||
COMMENT_RESULT=$(gh api graphql -f query='
|
||||
mutation($threadId: ID!, $body: String!) {
|
||||
addPullRequestReviewThreadReply(input: {
|
||||
pullRequestReviewThreadId: $threadId,
|
||||
body: $body
|
||||
}) {
|
||||
comment {
|
||||
id
|
||||
}
|
||||
}
|
||||
}' -f threadId="$THREAD_ID" -f body="$COMMENT")
|
||||
if echo "$COMMENT_RESULT" | jq -e '.errors' > /dev/null 2>&1; then
|
||||
echo "Error posting comment: $COMMENT_RESULT" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Step 2: Resolve the thread
|
||||
echo "Resolving thread..." >&2
|
||||
RESOLVE_RESULT=$(gh api graphql -f query='
|
||||
mutation($threadId: ID!) {
|
||||
resolveReviewThread(input: {threadId: $threadId}) {
|
||||
thread {
|
||||
id
|
||||
isResolved
|
||||
}
|
||||
}
|
||||
}' -f threadId="$THREAD_ID" --jq '.data.resolveReviewThread.thread')
|
||||
|
||||
echo "$RESOLVE_RESULT"
|
||||
echo "✓ Thread resolved" >&2
|
||||
Reference in New Issue
Block a user