From ec42085bd1cc6a671f1df2ddd86627b61fb9278b Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Fri, 10 Jul 2026 23:57:13 +0000 Subject: [PATCH 1/3] Trigger automated PR review workflow on issue comments The automated PR review workflow needs to trigger when maintainers leave `/review` conversation comments on PRs instead of requiring PR diff comments. Change event trigger to `issue_comment`, check that the issue is a PR, and check out `refs/pull/$NUMBER/head` so PR code is retrieved for conversation comments. --- .github/workflows/automated_pr_review.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/automated_pr_review.yaml b/.github/workflows/automated_pr_review.yaml index 23d4369b2a..89716f57d0 100644 --- a/.github/workflows/automated_pr_review.yaml +++ b/.github/workflows/automated_pr_review.yaml @@ -7,7 +7,7 @@ name: Automated Code Review on: pull_request: types: [opened] - pull_request_review_comment: + issue_comment: types: [created] permissions: @@ -20,19 +20,21 @@ jobs: # Trigger only if: # 1. It is a pull_request event, it is NOT a draft, and the author is a maintainer # (OWNER, MEMBER, or COLLABORATOR). - # 2. OR it is a pull_request_review_comment event, the comment body has a line starting with "/review", + # 2. OR it is a regular conversation comment on a pull request, the comment body has a line starting with "/review", # and the commenter is a maintainer. if: > (github.event_name == 'pull_request' && !github.event.pull_request.draft && contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)) || - (github.event_name == 'pull_request_review_comment' && - (startsWith(github.event.comment.body, '/review') || contains(github.event.comment.body, '\n/review')) && + (github.event_name == 'issue_comment' && github.event.issue.pull_request != null && + (startsWith(github.event.comment.body, '/review') || + contains(github.event.comment.body, '\n/review') || + contains(github.event.comment.body, '\r\n/review')) && contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)) steps: - name: Checkout PR Branch uses: actions/checkout@v7 with: - ref: ${{ github.event.pull_request.head.sha }} + ref: refs/pull/${{ github.event.pull_request.number || github.event.issue.number }}/head persist-credentials: false - name: Checkout Reviewbot (Base Branch) From d42e6a80f1c460010c2fea3fad4f54920e2a949d Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Sat, 11 Jul 2026 02:35:23 +0000 Subject: [PATCH 2/3] fix(pr-review): create virtual environment before pip install `uv pip install` fails when run outside an active virtual environment or without `--system`. Run `uv venv --python 3.13` before running `uv pip install` so dependencies are installed into a dedicated `.venv` directory discovered by `uv run`. --- .github/workflows/automated_pr_review.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/automated_pr_review.yaml b/.github/workflows/automated_pr_review.yaml index 89716f57d0..7baef0eb21 100644 --- a/.github/workflows/automated_pr_review.yaml +++ b/.github/workflows/automated_pr_review.yaml @@ -47,8 +47,10 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v8.3.0 - - name: Set up Python - run: uv python install 3.13 + - name: Set up Python and Virtual Environment + run: | + uv python install 3.13 + uv venv --python 3.13 - name: Install Dependencies run: | From c540f59a5170f9882a5bdfa56f4d3c375b80157d Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Sat, 11 Jul 2026 02:39:28 +0000 Subject: [PATCH 3/3] docs(pr-review): explain why issue.number is used for PR checkout During an `issue_comment` event on a pull request, `github.event.pull_request` is null and the PR number is stored in `github.event.issue.number`. Add an inline comment above `ref:` in `automated_pr_review.yaml` explaining that `github.event.issue.number` holds the pull request number when checking out `refs/pull/$NUMBER/head`. --- .github/workflows/automated_pr_review.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/automated_pr_review.yaml b/.github/workflows/automated_pr_review.yaml index 7baef0eb21..a512ae2427 100644 --- a/.github/workflows/automated_pr_review.yaml +++ b/.github/workflows/automated_pr_review.yaml @@ -34,6 +34,9 @@ jobs: - name: Checkout PR Branch uses: actions/checkout@v7 with: + # Note: In GHA, during an issue_comment event on a PR, github.event.pull_request is null + # and the PR number is placed inside github.event.issue.number (because every PR is an issue). + # Therefore, github.event.issue.number is the PR number when checking out refs/pull//head. ref: refs/pull/${{ github.event.pull_request.number || github.event.issue.number }}/head persist-credentials: false