Skip to content

GitHub CLI adds gh event, so scripts stop polling for PR status

A preview command in gh 2.105.0 lets scripts and agents wait for a pull request review, merge conflict or check suite to finish, instead of polling the API on a timer.

Source: GitHub CLI

GitHub CLI 2.105.0 ships a preview of GitHub Event Streams: a new gh event command set that waits for pull request and check suite events instead of polling. gh event listen blocks until a matching event fires, then prints it as CloudEvent JSON.

gh event listen --resource https://github.com/OWNER/REPO/pull/NUMBER \
  --event com.github.pull_request.check_suite.status.changed.v1 \
  --jq .data.conclusion

Supported events cover submitted reviews, pull request state and head changes, merge conflicts, and completed check suites. gh event listen exits after the first match by default, with --count to wait for several and --follow to keep listening. A separate gh event subscription set (list, create, view, delete) manages longer-lived subscriptions. The feature is in preview behind a waitlist.

Why it matters: any script or agent that currently loops on gh pr checks or gh run watch to find out when CI finishes can replace that loop with a single blocking call. That is less API quota burned and less code written to handle “not done yet” responses, particularly useful for agents that chain actions off a merge or a review.

The caveat: it is a preview feature gated by a waitlist, so it is not yet something you can rely on in production CI without applying for access first.

Share

More from The Wire

All briefs