You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: trigger unresolve workflow on thread resolve, not every push (#5261)
##### What this PR does / why we need it:
The `unresolve-coderabbit-threads` workflow previously triggered on
`pull_request_target: [synchronize]` (every push), paginating through
ALL review threads to find resolved ones. This was wasteful — it ran on
every push even when no threads were resolved.
This PR changes the trigger to `pull_request_review_thread: [resolved]`,
which fires only when a thread is actually resolved. The event payload
provides the specific thread's `node_id`, so we query only that one
thread via GraphQL `node(id:)` instead of paginating all threads.
Same validation logic is preserved: skip non-CodeRabbit threads, check
for substantive PR author replies (≥15 chars) or CodeRabbit verification
markers, unresolve + warn if neither is found.
##### Which issue(s) this PR fixes:
Fixes#5260
##### Special notes for reviewer:
`pull_request_review_thread` is an undocumented but functional GitHub
webhook event that fires when a review thread is resolved/unresolved.
##### jira-ticket:
NONE
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Ruth Netser <rnetser@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
addPullRequestReviewThreadReply(input: {pullRequestReviewThreadId: \"$thread_id\", body: \"⚠️ This thread was automatically unresolved because it was resolved without a substantive response. Please address the review comment and explain how it was resolved before resolving this thread again.\"}) {
101
+
comment {
102
+
id
103
+
}
104
+
}
105
+
}
106
+
" || echo " Warning: failed to add comment to $thread_id"
# Add a comment to the thread explaining why it was unresolved
127
-
gh api graphql -f query="
128
-
mutation {
129
-
addPullRequestReviewThreadReply(input: {pullRequestReviewThreadId: \"$thread_id\", body: \"\u26a0\ufe0f This thread was automatically unresolved because it was resolved without a substantive response. Please address the review comment and explain how it was resolved before resolving this thread again.\"}) {
130
-
comment {
131
-
id
148
+
# --- Path 2: pull_request_target (paginate all threads) ---
149
+
else
150
+
echo "Trigger: pull_request_target — scanning all resolved threads for PR #$PR_NUMBER"
0 commit comments