Skip to content
DrCompsSignal / computer news
Menu

GitHub CLI can wait for pull-request events instead of polling

GitHub CLI 2.105.0 adds preview event-stream commands for waiting on pull-request reviews, state changes, commits, conflicts, and checks.

GitHub CLI 2.105.0 adds an event-stream command that can wait for pull-request changes without repeatedly polling GitHub’s APIs. The preview turns reviews, state changes, new commits, merge conflicts, and completed check suites into line-delimited CloudEvent JSON for scripts and agents.

What changed

The new gh event listen command accepts a pull-request URL and one or more event types, creates or reuses a subscription, attaches to the stream, and prints each event to standard output. It exits after the first event by default, or can wait for a count, follow continuously, apply a timeout, and filter output with --jq or templates.

GitHub also added commands to create, list, inspect, and delete subscriptions directly. Existing CLI flows such as gh pr view and gh run watch now point users and agents toward event listening when polling is unnecessary.

Practical consequence

Automation can sleep until a review arrives, a pull request changes state, a branch receives a push, a merge conflict appears, or a check suite finishes. That reduces repeated API calls and makes long-running agent loops simpler because the event itself can trigger the next state check.

The events are intentionally thin and include an API URL for fetching the changed object. A robust workflow should attach the listener and then read current pull-request state, because events that occurred before attachment are not replayed.

Limits and evidence

Both gh event and the underlying GitHub Event Streams service are previews. Access requires the Event Streams waitlist, works only for pull requests on GitHub.com, and is not available on GitHub Enterprise Server or GHE.com.

Subscriptions expire after 24 hours and accounts can hold only a limited number. A broken stream reconnects, but events emitted while disconnected are not delivered. GitHub published no latency, reliability, or API-cost benchmark, and DrComps has not independently measured event delivery.