GitHub CLI can now wait for a pull request event with gh event listen. Before building it into a review workflow, account for changes that happened before the listener attached. Start listening, read the current pull request state, and use incoming events to decide when to read again. That sequence helps avoid leaving a script waiting for a review that already arrived.

The November 18 announcement introduces the commands in GitHub CLI v2.105.0. They are in preview and require Event Streams preview access through a waitlist. Check both access and CLI version before replacing an existing workflow.
Decide what your workflow is waiting for
“A review arrived” and “the pull request is ready to merge” are different conditions. For example, a team may want a notification when anyone submits a review, while its release process requires approval from a particular maintainer and passing checks. Write down the condition your script needs before selecting an event. A narrow first use, such as prompting you to inspect a newly submitted review, is easier to verify than a script that makes a release decision.
Try a bounded listener
The command manual documents the resource URL, event type and timeout. Replace the example repository and PR number below with a pull request you can access. This example waits for a submitted review for up to 15 minutes.
gh event listen \
--resource https://github.com/OWNER/REPO/pull/123 \
--event com.github.pull_request.review.submitted.v1 \
--timeout 15m
Once the stream reports that it is attached, inspect the pull request in another terminal. The PR view manual describes how to read its current details. If the condition you need is already satisfied, handle that result rather than waiting for the same action to happen again.
Treat an event as a reason to inspect
By default, the listener stops after one event. GitHub’s manual says earlier events are not replayed, and changes during a disconnection are not delivered. After a reconnect, read the current state again. For a review notification, inspect the review’s content and author before deciding what comes next. Keep that decision in your workflow so a submitted request for changes receives the attention it needs.
A check-suite completion also needs interpretation. A pull request can have multiple suites, so inspect its checks before proceeding. TechPulse’s pull request review guide explains how to follow the evidence behind a status.
Handle timeout and handoff explicitly
The documented timeout exit status is 8. Decide whether your script should ask a person to check the PR or try again later. Include the PR URL and the condition still being awaited in that handoff. For a first trial, observe one review event and one timeout with a teammate, then compare the behavior with your written requirement. Keep a record of the CLI version and preview access used so someone can repeat the check.
Prepared with AI assistance from GitHub’s announcement and CLI manuals. Commands are documentation-based examples and were not executed against a live pull request by TechPulse. See our editorial policy.
✍️ Leave a Comment