Skip to content

feat: auto-trigger PR review when all readiness criteria are met#323

Merged
don-petry merged 11 commits into
mainfrom
feat/pr-auto-review
May 19, 2026
Merged

feat: auto-trigger PR review when all readiness criteria are met#323
don-petry merged 11 commits into
mainfrom
feat/pr-auto-review

Conversation

@don-petry
Copy link
Copy Markdown
Contributor

@don-petry don-petry commented May 18, 2026

Summary

Adds a new pr-auto-review workflow that automatically dispatches the review agent when a PR becomes ready for review — no manual @donpetry-bot mention needed.

Trigger events

Event Why
check_suite: completed CI finished — may have just turned all-green
pull_request_review: submitted/dismissed A changes-requested review was submitted or dismissed
pull_request_review_thread: resolved A review thread was just resolved

Readiness criteria (all must pass)

  1. PR is open and not a draft
  2. All CI checks passing — no pending or failing buckets (gh pr checks)
  3. No CHANGES_REQUESTED reviews — checked via the Reviews REST API
  4. No unresolved review threads — checked via GraphQL (reviewThreads.isResolved)

If any criterion fails the workflow exits silently with no dispatch.

Files

File Purpose
.github/workflows/pr-auto-review-reusable.yml Org-level reusable with all logic
.github/workflows/pr-auto-review.yml Thin caller for this repo (local ref)
standards/workflows/pr-auto-review.yml Template for other repos (@v2)

Adoption

Copy standards/workflows/pr-auto-review.yml to .github/workflows/pr-auto-review.yml in any repo. The GH_PAT_WORKFLOWS org secret is already present everywhere.

Note: The v2 tag should be updated to include this commit after merge so repos using @v2 pick it up.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Summary by CodeRabbit

  • Chores
    • Implemented automated pull request readiness validation. The system now checks that submissions meet required criteria and automatically processes ready requests for review.

Review Change Stack

don-petry and others added 3 commits May 18, 2026 18:23
Fires a review-agent dispatch when a PR meets all readiness criteria:
- All CI checks passing
- No CHANGES_REQUESTED reviews
- No unresolved review threads

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@don-petry don-petry requested a review from a team as a code owner May 18, 2026 23:24
Copilot AI review requested due to automatic review settings May 18, 2026 23:24
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

Warning

Rate limit exceeded

@don-petry has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 44 minutes and 57 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1ea73382-a907-45c6-afe2-893e09abf301

📥 Commits

Reviewing files that changed from the base of the PR and between 6306793 and c829492.

📒 Files selected for processing (3)
  • .github/workflows/pr-auto-review-reusable.yml
  • .github/workflows/pr-auto-review.yml
  • standards/workflows/pr-auto-review.yml
📝 Walkthrough

Walkthrough

Adds a reusable GitHub Actions workflow that validates PR readiness (open, not draft, checks passing, no requested changes, no unresolved threads) and conditionally dispatches a pr-review-mention event to a private repo. Includes local and org-level caller workflows.

Changes

PR Auto-Review Readiness Gate

Layer / File(s) Summary
Reusable workflow definition and contract
.github/workflows/pr-auto-review-reusable.yml
Documents the readiness gate purpose, criteria, triggering events, and required GH_PAT_WORKFLOWS secret; defines workflow_call interface and job-level PR read permissions.
Event resolution and routing
.github/workflows/pr-auto-review-reusable.yml
Resolves target PR URL from check_suite, pull_request_review, and pull_request_review_thread events; exits early on unsuccessful check suite conclusions and non-applicable PR states.
PR readiness validation
.github/workflows/pr-auto-review-reusable.yml
Validates PR open/non-draft state, requires at least one passing CI check, checks for zero CHANGES_REQUESTED reviews via REST, and queries zero unresolved review threads via GraphQL.
Dispatch on ready
.github/workflows/pr-auto-review-reusable.yml
Posts pr-review-mention dispatch event to private repo when all readiness criteria pass, passing the PR URL in the payload.
Workflow callers
.github/workflows/pr-auto-review.yml, standards/workflows/pr-auto-review.yml
Local and standards caller workflows invoke the reusable workflow with appropriate event triggers, minimal permissions, and secret inheritance; standards caller targets the published org-level version at @v2.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding an auto-trigger workflow for PR reviews when readiness criteria are met, which matches the core functionality across all three workflow files added.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pr-auto-review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new GitHub Actions workflow, pr-auto-review.yml, which serves as a caller for a reusable PR readiness check. The review feedback identifies that the workflow triggers are incomplete, missing essential pull_request events like opened and ready_for_review. Additionally, the job permissions are currently insufficient and need to be expanded to include read access for checks, statuses, and actions to ensure the automation can correctly retrieve CI status and metadata.

Comment thread standards/workflows/pr-auto-review.yml Outdated
Comment on lines +26 to +32
on:
check_suite:
types: [completed]
pull_request_review:
types: [submitted, dismissed]
pull_request_review_thread:
types: [resolved]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The workflow is intended to trigger when a PR becomes ready for review, but the current trigger set misses several critical events. Specifically, it should include the pull_request event with types opened, reopened, and ready_for_review.

  • ready_for_review: Essential for triggering the check when a draft PR is marked as ready.
  • opened / reopened: Ensures the workflow runs for PRs that might already satisfy all readiness criteria upon creation (e.g., if CI was already completed on the branch before the PR was opened).

Without these, the automation will not fire in these common scenarios, requiring manual intervention which defeats the purpose of the auto-trigger.

on:
  check_suite:
    types: [completed]
  pull_request:
    types: [opened, reopened, ready_for_review]
  pull_request_review:
    types: [submitted, dismissed]
  pull_request_review_thread:
    types: [resolved]

Comment on lines +38 to +39
permissions:
pull-requests: read
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current permissions are insufficient for the readiness criteria described in the PR summary. The gh pr checks command (and the underlying GitHub API calls) requires checks: read and statuses: read to retrieve the status of CI runs. Additionally, actions: read is recommended to allow the reusable workflow to inspect other workflow runs, aligning with the permissions granted to other review-related agents in the organization (e.g., Claude Code as documented in standards/ci-standards.md).

    permissions:
      pull-requests: read
      checks: read
      statuses: read
      actions: read

coderabbitai[bot]
coderabbitai Bot previously requested changes May 18, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pr-auto-review-reusable.yml:
- Around line 121-129: The script incorrectly counts historical
CHANGES_REQUESTED reviews by using the gh api call that lists all reviews and
setting CHANGES_REQ, causing false positives; replace that logic with a call to
gh pr view to read the effective reviewDecision field and base the check on
reviewDecision == "CHANGES_REQUESTED" (or not "APPROVED") instead of the
CHANGES_REQ count, updating the section that references CHANGES_REQ and the gh
api "/repos/${REPO}/pulls/${PR_NUMBER}/reviews" call to use gh pr view --json
reviewDecision and branch the logic on the reviewDecision value.

In `@standards/workflows/pr-auto-review.yml`:
- Around line 31-32: The workflow uses an invalid GitHub Actions event name
"pull_request_review_thread"; update the workflow trigger to a supported event
such as "pull_request_review" (or "pull_request_review_comment" if you need
comment-specific threads) by replacing the "pull_request_review_thread" entry in
the pull_request_review_thread trigger block with the correct event name so
actionlint stops reporting "unknown Webhook event." Ensure you update the types
array if needed to match the chosen event's valid types.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7ddbb5a0-75ba-4fce-bab7-a5636499c045

📥 Commits

Reviewing files that changed from the base of the PR and between 6306793 and 8543b1b.

📒 Files selected for processing (3)
  • .github/workflows/pr-auto-review-reusable.yml
  • .github/workflows/pr-auto-review.yml
  • standards/workflows/pr-auto-review.yml

Comment thread .github/workflows/pr-auto-review-reusable.yml Outdated
Comment thread standards/workflows/pr-auto-review.yml Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an org-level PR auto-review workflow that dispatches the existing review agent when a pull request appears ready without requiring a manual bot mention.

Changes:

  • Adds a reusable readiness-gate workflow that resolves the PR, checks CI/review/thread criteria, and dispatches the review agent.
  • Adds a local thin caller workflow for this repository.
  • Adds a standard caller template for adoption by other org repositories.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/pr-auto-review-reusable.yml Implements readiness checks and repository dispatch logic.
.github/workflows/pr-auto-review.yml Adds this repo’s local caller for the reusable workflow.
standards/workflows/pr-auto-review.yml Adds the reusable workflow adoption template for other repos.
Comments suppressed due to low confidence (2)

.github/workflows/pr-auto-review-reusable.yml:123

  • Counting every historical CHANGES_REQUESTED review means a reviewer who later submits an approving/comment-only review still leaves the old changes-requested review in this list, so the auto-review can remain permanently blocked after the request is resolved. Derive the latest non-dismissed review state per reviewer (or use the review decision from GraphQL) instead of counting all historical reviews.
          # 3. No reviews in CHANGES_REQUESTED state.
          CHANGES_REQ=$(gh api "/repos/${REPO}/pulls/${PR_NUMBER}/reviews" \
            --jq '[.[] | select(.state == "CHANGES_REQUESTED")] | length')

.github/workflows/pr-auto-review-reusable.yml:136

  • This only inspects the first 100 review threads. PRs with more than 100 threads can have an unresolved thread beyond the first page and still dispatch the review agent; paginate reviewThreads until hasNextPage is false or query an aggregate that accounts for all threads.
                  reviewThreads(first:100){nodes{isResolved}}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

name: PR Auto-Review — Ready Check

on:
check_suite:
name: PR Auto-Review — Ready Check

on:
check_suite:
# 2. All CI checks must be completed and passing.
# gh pr checks --json returns objects with a "bucket" field:
# "pass" | "skipping" | "fail" | "pending" | "cancel"
CHECKS=$(gh pr checks "$PR_URL" --json bucket,name 2>/dev/null || echo "[]")
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8543b1be5a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +112 to +113
NOT_PASSING=$(echo "$CHECKS" | \
jq '[.[] | select(.bucket != "pass" and .bucket != "skipping")] | length')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Exclude the auto-review job from the checks gate

When this workflow is running for a ready PR, it creates its own PR check before this step executes; gh pr checks reports pending checks in the pending bucket, and this filter treats any non-pass/non-skipping bucket as not ready. That means the auto-review run blocks itself on every check_suite, review, or thread-resolution trigger and never reaches the dispatch step unless its own check is excluded or only the intended required CI checks are queried.

Useful? React with 👍 / 👎.

Comment on lines +26 to +27
check_suite:
types: [completed]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Do not rely on check_suite for Actions CI

The stated CI-finished trigger will not run for the org's normal GitHub Actions checks: GitHub's Actions docs for check_suite say the event does not trigger workflows when the suite was created by GitHub Actions or the head SHA is associated with GitHub Actions. For PRs whose readiness depends on these workflows, no auto-review run is started when CI turns green, so this needs a trigger that actually fires for Actions CI completion.

Useful? React with 👍 / 👎.

set -euo pipefail

# Fetch basic PR metadata in one call.
PR_META=$(gh pr view "$PR_URL" --json state,isDraft,number,baseRepository)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use a supported gh pr view JSON field

gh pr view --help/the GitHub CLI manual lists the supported JSON fields and baseRepository is not one of them, so this command exits with an unknown-field error before any readiness criteria are checked. As written, every non-skipped trigger fails here instead of dispatching; use a supported field such as url/headRepository or derive the base repo from the PR URL/API response.

Useful? React with 👍 / 👎.

don-petry and others added 8 commits May 18, 2026 20:15
- Replace pull_request_review_thread (invalid GH Actions event) with
  workflow_run and pull_request event handling
- Add workflow_run:completed trigger for Actions-based CI (check_suite
  does not fire for GH Actions runs)
- Add pull_request:[opened,reopened,synchronize,ready_for_review] trigger
- Use reviewDecision from gh pr view instead of REST reviews list to
  correctly reflect effective review state (avoids false positives from
  historical CHANGES_REQUESTED reviews)
- Fix gh pr checks capture: use || true instead of || echo '[]' so the
  JSON payload is preserved when checks are failing/pending
- Exclude own in-progress check run from CI gate to prevent self-blocking
- Add checks:read and actions:read job permissions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove pull_request_review_thread (invalid GH Actions event)
- Add workflow_run:[CI] for Actions-based CI completion
- Add pull_request:[opened,reopened,synchronize,ready_for_review]
- Add checks:read and actions:read job permissions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove pull_request_review_thread (invalid GH Actions event)
- Add workflow_run with TODO comment for CI workflow name customization
- Add pull_request:[opened,reopened,synchronize,ready_for_review]
- Add checks:read and actions:read job permissions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add '# shellcheck disable=SC2016' before jq --arg self usage; the
  $self token is a jq variable (passed via --arg), not a shell variable
- Replace baseRepository (not a valid gh pr view --json field) with URL
  parsing: sed 's|https://github.com/||; s|/pull/.*||'

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace single-quoted jq filter containing $self (a jq variable) with a
double-quoted string using \\, which produces a literal dollar sign
for jq without triggering shellcheck SC2016 (expressions don't expand in
single quotes).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
GraphQL variables ($owner, $repo, $number) in the -f query= string
triggered SC2016. Use a double-quoted string with \\$ escaping so the
shell produces literal dollar signs for GraphQL without shellcheck
interpreting them as unexpanded shell variables in single quotes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…herit

Resolves SonarCloud security hotspot S7635 (githubactions:S7635).
Only GH_PAT_WORKFLOWS is needed by the reusable workflow.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@don-petry
Copy link
Copy Markdown
Contributor Author

Addressing CodeRabbit CHANGES_REQUESTED

Both issues from CodeRabbit's review have been fixed in earlier commits:

  1. Historical CHANGES_REQUESTED reviews (line 121-129) — Fixed: the code now uses gh pr view --json reviewDecision which returns the effective aggregate state (CHANGES_REQUESTED, APPROVED, etc.) rather than counting historical review events. A reviewer who later approves will no longer cause a false positive.

  2. pull_request_review_thread invalid event (standards template) — Fixed: removed from all three files. The trigger was replaced with pull_request_review (with types submitted and dismissed) and additional pull_request events.

Also just pushed: replaced secrets: inherit with an explicit secrets: GH_PAT_WORKFLOWS mapping to resolve the SonarCloud S7635 security hotspot.

@coderabbitai please re-review.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

@don-petry Thanks for the detailed summary of the fixes! All three changes look well-considered:

  1. reviewDecision aggregate state — using gh pr view --json reviewDecision is the correct approach; it reflects the current effective decision rather than the raw history of review events, eliminating the false-positive concern.
  2. pull_request_review_thread removal — good call; that event type isn't valid in GitHub Actions, and replacing it with pull_request_review + pull_request types is the proper substitute.
  3. Explicit secret mapping — replacing secrets: inherit with an explicit secrets: GH_PAT_WORKFLOWS is a security best practice and correctly resolves the S7635 hotspot.

Kicking off a fresh review now!

✅ Actions performed

Full review triggered.

@sonarqubecloud
Copy link
Copy Markdown

@don-petry don-petry enabled auto-merge (squash) May 19, 2026 01:32
@don-petry don-petry dismissed coderabbitai[bot]’s stale review May 19, 2026 01:33

Both issues addressed: reviewDecision used instead of historical reviews list; pull_request_review_thread removed. Dismissing to unblock merge.

@don-petry don-petry merged commit 376a4fc into main May 19, 2026
20 checks passed
@don-petry don-petry deleted the feat/pr-auto-review branch May 19, 2026 01:34
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c829492edf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# to catch CI turning green on a PR.
# TODO: replace "CI" with your repository's CI workflow name(s).
workflow_run:
workflows: ["CI"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Trigger on all gated Actions workflows

With the standard workflow set I checked (Dependency audit, AgentShield, and this repo's SonarCloud Analysis are also GitHub Actions workflows), gh pr checks gates on checks beyond CI. If CI completes while one of those checks is still pending, this run skips; when that later Actions workflow turns green, this workflow_run filter does not fire and check_suite still will not cover GitHub Actions-created suites, so ready PRs can remain undispatched until some unrelated PR/review event. Include every Actions workflow that can appear in the readiness gate, or trigger on all completed workflow runs and let the existing gate decide readiness.

Useful? React with 👍 / 👎.

Comment on lines +39 to +40
pull_request_review:
types: [submitted, dismissed]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recheck readiness when review threads are resolved

When the only remaining blocker is an unresolved review thread, resolving the final thread does not submit or dismiss a PR review, so this workflow never re-runs to observe UNRESOLVED=0; GitHub exposes thread resolution as separate pull_request_review_thread webhook activity rather than as pull_request_review. In that scenario the PR satisfies all criteria but no auto-review is dispatched until another unrelated PR or CI event occurs, so add a supported mechanism to re-evaluate on thread resolution (for example a webhook/dispatch bridge or scheduled fallback).

Useful? React with 👍 / 👎.

Comment on lines +42 to +43
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid PAT-backed runs on Dependabot PR events

For Dependabot PRs, GitHub treats pull_request/pull_request_review workflows as fork-originated and does not expose normal Actions secrets, so this trigger can invoke the reusable without GH_PAT_WORKFLOWS; the next gh pr view call then fails authentication instead of cleanly skipping. Because this organization relies on Dependabot workflows, opening or updating a Dependabot PR will produce a red auto-review workflow run unless the event is skipped before the PAT is needed or the credential is also supplied as a Dependabot secret.

Useful? React with 👍 / 👎.

Comment on lines +185 to +190
UNRESOLVED=$(gh api graphql \
-f "query=query(\$owner:String!,\$repo:String!,\$number:Int!){repository(owner:\$owner,name:\$repo){pullRequest(number:\$number){reviewThreads(first:100){nodes{isResolved}}}}}" \
-f owner="${REPO%%/*}" \
-f repo="${REPO##*/}" \
-F number="${PR_NUMBER}" \
--jq "[.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false)] | length")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Paginate review threads before dispatching

When a large PR has more than 100 review threads and the first page is resolved but a later page still has an unresolved thread, this query only inspects reviewThreads(first:100) and then dispatches the review agent even though the stated readiness criterion is not met. Please loop on pageInfo.hasNextPage/endCursor or otherwise query all review threads before treating UNRESOLVED=0 as authoritative.

Useful? React with 👍 / 👎.

Comment on lines +42 to +43
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Do not expose the PAT to PR branch workflow code

On same-repository PRs, the pull_request run has access to normal Actions secrets while executing the workflow definition from the PR merge ref, so a branch that modifies this stub or the referenced reusable can read GH_PAT_WORKFLOWS before the change is merged. Because this token is described as a classic repo-scoped PAT, use a default-branch context such as pull_request_target/workflow_run for the secret-bearing dispatch path or split the untrusted PR trigger from the privileged API call.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants