Skip to content

Commit 51995a3

Browse files
fix(ci): simplify GraphQL query to avoid variable escaping issues
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
1 parent 9fe53fa commit 51995a3

1 file changed

Lines changed: 4 additions & 15 deletions

File tree

.github/workflows/auto-approve.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,10 @@ jobs:
5757
COPILOT_REVIEW=$(gh api "repos/${{ github.repository }}/pulls/$PR_NUMBER/reviews" --jq '[.[] | select(.user.login == "copilot-pull-request-reviewer[bot]")] | length')
5858
5959
# Use GraphQL to count unresolved Copilot review threads
60-
UNRESOLVED_THREADS=$(gh api graphql -f query='
61-
query($owner: String!, $repo: String!, $pr: Int!) {
62-
repository(owner: $owner, name: $repo) {
63-
pullRequest(number: $pr) {
64-
reviewThreads(first: 100) {
65-
nodes {
66-
isResolved
67-
comments(first: 1) {
68-
nodes { author { login } }
69-
}
70-
}
71-
}
72-
}
73-
}
74-
}' -f owner="${{ github.repository_owner }}" -f repo="${{ github.event.repository.name }}" -F pr="$PR_NUMBER" \
60+
REPO_OWNER="${{ github.repository_owner }}"
61+
REPO_NAME="${{ github.repository }}"
62+
REPO_NAME="${REPO_NAME#*/}" # Extract repo name from owner/repo
63+
UNRESOLVED_THREADS=$(gh api graphql -f query="query { repository(owner: \"$REPO_OWNER\", name: \"$REPO_NAME\") { pullRequest(number: $PR_NUMBER) { reviewThreads(first: 100) { nodes { isResolved comments(first: 1) { nodes { author { login } } } } } } } }" \
7564
--jq '[.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false and .comments.nodes[0].author.login == "copilot-pull-request-reviewer")] | length')
7665
7766
COPILOT_OK="false"

0 commit comments

Comments
 (0)