-
Notifications
You must be signed in to change notification settings - Fork 0
Sync Kaizen shared skills #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,6 @@ query($owner:String!, $name:String!, $number:Int!, $cursor:String) { | |
| repository(owner:$owner, name:$name) { | ||
| pullRequest(number:$number) { | ||
| headRefOid | ||
| headRepository { nameWithOwner } | ||
| reviewDecision | ||
| mergeStateStatus | ||
| reviewThreads(first:100, after:$cursor) { | ||
|
|
@@ -57,19 +56,7 @@ query($owner:String!, $name:String!, $number:Int!, $cursor:String) { | |
| if [[ -n "${cursor}" ]]; then | ||
| args+=(-f "cursor=${cursor}") | ||
| fi | ||
| if ! page="$(gh "${args[@]}")"; then | ||
| echo 'failed to fetch review threads' >&2 | ||
| exit 1 | ||
| fi | ||
| if ! jq -e ' | ||
| .data.repository.pullRequest.reviewThreads as $threads | ||
| | ($threads | type == "object") | ||
| and ($threads.nodes | type == "array") | ||
| and ($threads.pageInfo.hasNextPage | type == "boolean") | ||
| ' >/dev/null <<<"${page}"; then | ||
| echo 'reviewThreads returned an invalid or incomplete response' >&2 | ||
| exit 1 | ||
| fi | ||
| page="$(gh "${args[@]}")" | ||
| jq -c '.data.repository.pullRequest.reviewThreads.nodes[]' <<<"${page}" | ||
| if [[ "$(jq -r '.data.repository.pullRequest.reviewThreads.pageInfo.hasNextPage' <<<"${page}")" != true ]]; then | ||
| break | ||
|
|
@@ -106,19 +93,7 @@ query($threadId:ID!, $cursor:String) { | |
| if [[ -n "${cursor}" ]]; then | ||
| args+=(-f "cursor=${cursor}") | ||
| fi | ||
| if ! page="$(gh "${args[@]}")"; then | ||
| echo 'failed to fetch review comments' >&2 | ||
| exit 1 | ||
| fi | ||
| if ! jq -e ' | ||
| .data.node.comments as $comments | ||
| | ($comments | type == "object") | ||
| and ($comments.nodes | type == "array") | ||
| and ($comments.pageInfo.hasNextPage | type == "boolean") | ||
| ' >/dev/null <<<"${page}"; then | ||
| echo 'review comments returned an invalid or incomplete response' >&2 | ||
| exit 1 | ||
| fi | ||
| page="$(gh "${args[@]}")" | ||
| jq -c '.data.node.comments.nodes[]' <<<"${page}" | ||
| if [[ "$(jq -r '.data.node.comments.pageInfo.hasNextPage' <<<"${page}")" != true ]]; then | ||
| break | ||
|
|
@@ -131,15 +106,14 @@ query($threadId:ID!, $cursor:String) { | |
| done | ||
| ``` | ||
|
|
||
| Exhaust each REST endpoint with `--paginate`; summaries and first pages are incomplete evidence. Check runs can be owned by either side of a fork PR: head-repository workflows usually create runs in the head repository, while base-repository Actions and installed apps can create them in the base repository. Read `headRepository.nameWithOwner` from the GraphQL response above, query both base and head repositories when they differ, and retain the repository name alongside every returned check-run ID. Fetch each run's annotations from the same repository that returned it, deduplicating identical run IDs. If either repository query fails or the head repository is unavailable, stop and report the audit as incomplete. | ||
| Exhaust each REST endpoint with `--paginate`; summaries and first pages are incomplete evidence: | ||
|
|
||
| ```sh | ||
| gh api --paginate 'repos/<owner>/<repo>/pulls/<pr>/reviews?per_page=100' | ||
| gh api --paginate 'repos/<owner>/<repo>/pulls/<pr>/comments?per_page=100' | ||
| gh api --paginate 'repos/<owner>/<repo>/issues/<pr>/comments?per_page=100' | ||
| gh api --paginate 'repos/<owner>/<repo>/commits/<head-sha>/check-runs?per_page=100' | ||
| gh api --paginate 'repos/<head-owner>/<head-repo>/commits/<head-sha>/check-runs?per_page=100' # when different | ||
| gh api --paginate 'repos/<check-run-owner>/<check-run-repo>/check-runs/<check-run-id>/annotations?per_page=100' | ||
| gh api --paginate 'repos/<owner>/<repo>/check-runs/<check-run-id>/annotations?per_page=100' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For fork PRs where checks are created in the head repository, hard-coding annotation fetches to Useful? React with 👍 / 👎. |
||
| ``` | ||
|
|
||
| ## Reply, then resolve | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this unguarded command substitution (and the same pattern in the nested comment loop), an auth, rate-limit, or GraphQL failure leaves
pageempty or shaped like an error response; the followingjq -r ...hasNextPagethen yields an empty string/null, so the loop breaks and the guardian can report zero unresolved feedback instead of blocking as an incomplete audit. The repo requires the vendored PR guardian to keep running until a PR is truly mergeable, so this should fail closed and validate the response before continuing.Useful? React with 👍 / 👎.