Dev News Daily ENDE

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

GitHub announced on 18 November that its CLI now supports GitHub Event Streams. With gh v2.105.0, users and agents can wait for a pull request to change with one command instead of polling it in a loop. gh event listen takes a pull request URL and the events of interest, such as a submitted review, creates the subscription, opens the stream and prints each event as a line of JSON.

By default the command exits after the first event, so it fits into scripts and agent loops. --count waits for several events, --follow keeps listening and --timeout stops waiting; --jq and --template extract fields. The events available are submitted reviews, pull request state and head changes, merge conflicts and completed check suites. Subscriptions can be managed directly with gh event subscription create, list, view and delete.

GitHub says agents discover the commands on their own: gh pr create, gh pr view, gh run view, gh run watch and gh api now suggest gh event listen instead of polling. The gh event commands are in preview and may change, and they require access to Event Streams, which is itself in preview with a waitlist.

GitHub CLI 2.105 can wait for pull request events instead of polling
GitHub CLI 2.105 can wait for pull request events instead of polling — Dev News Daily

Why it matters

Polling is how scripts and agents wait for a review or a check today; a command that blocks until the event arrives removes both the loop and its API calls. The catch for now is the waitlist.

Written by Victoria Shinder.