GitHub CLI now supports GitHub Event Streams. With gh v2.105.0, you and your agents can wait for a pull request to change with a single command instead of polling it in a loop.
Run gh event listen with a pull request URL and the events you care about, such as a submitted review. It creates the subscription, opens the stream and prints each event as a line of JSON.
- By default, it exits after the first event, so it slots into scripts and agent loops.
- Use
--countto wait for several events,--followto keep listening, and--timeoutto stop waiting. - Use
--jqor--templateto pull out just the fields you need.
You can wait for submitted reviews, pull request state and head changes, merge conflicts and completed check suites. To manage subscriptions directly, use gh event subscription create, list, view, and delete.
Agents discover the new 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.
Availability
The gh event commands are in preview and may change. They require access to Event Streams, which is in preview on GitHub.com. To get access, sign up for the Event Streams waitlist.
To get started, upgrade to gh v2.105.0 or later. For details, see the gh event manual and the Event Streams documentation, or run gh event --help.
Share your feedback in the GitHub Community discussion.
The post Wait for pull request events with GitHub CLI appeared first on The GitHub Blog.





