· 2 min read · Security & ops · 閱讀中文版
GitHub CLI PR events: a notification still needs a state check
GitHub CLI’s Event Streams preview can wake an agent when a PR changes. Reliable automation still needs current-state checks, commit identity, bounded waits and safe retries.
On this page
Waiting for a pull request often turns into a loop of asking the same question. GitHub’s latest CLI update introduces another entry point: wait for a change, then decide what to do.
What is available?
On November 18, 2026, GitHub announced Event Streams support in CLI v2.105.0. gh event listen waits for PR changes, exits after the first event by default and supports a timeout. Both the commands and service are in preview; service access is required. See the official announcement.
The approach below is 8plus’s workflow recommendation, not a report of a production integration with this preview.
Treat an event as a reason to check again
Suppose automation is waiting for checks on commit A. A developer pushes B before a completion notification arrives. That notification alone cannot establish that the current PR is ready. Read the current head, verify which revision the required checks cover, and inspect their conclusions and the applicable merge conditions.
A submitted review also does not necessarily mean approval or that every review requirement is satisfied. Separating the wake-up signal from the decision makes the workflow easier to explain.
Give waiting an explicit exit
A conceptual sequence is:
- Establish a listener and confirm readiness.
- Read current state. If the condition already holds, stop waiting and clean up.
- On an event, read state again and verify the PR, commit and required conditions.
- Continue only within the deadline. Record and stop on timeout, lost access or connection failure.
This is a design outline, not executable CLI syntax. Listening before reading can reduce an initialization gap, but delivery, reconnection and replay behavior must be checked against service documentation and tests. Do not assume a preview guarantees that no events are lost.
A retry must not become a second deployment
Repeated notifications or restarted workers should be able to recognize an operation already completed for a revision. A work identity can include the repository, PR number, commit SHA and operation type, with a record of the successful result.
Different actions have different side effects. Publishing a message, deploying and modifying remote state cannot all be retried blindly. If the outcome is uncertain, inspect actual state before repeating the action. Existing production approvals and protections still apply.
Test the uncomfortable cases
Include a new push during the wait, a review that does not satisfy the condition, a disconnected stream and a timeout. Check that incomplete work remains explicitly incomplete.
Useful logs capture the wait’s start and end, the last verified revision, unmet conditions and the exit reason. Keep access tokens and sensitive payloads out. The next operator should know whether to wait, retry or investigate.
Start with a read-only workflow
Teams with preview access can begin with a PR status reminder, comparing request volume, waiting time and explainability of failures with their existing bounded polling. Add actions with side effects only after those behaviors are understood. Teams without access can still improve backoff, deadlines and revision checks today.
An event tells automation when to look again. The current revision and its actual conditions should determine whether work can proceed.
Related: Copilot team plugin rollout and AI agent handoffs.