.nh .TH "GH-EVENT-LISTEN" "1" "Nov 2026" "" "GitHub CLI manual" .SH NAME gh-event-listen - Wait for events on a specific resource .SH SYNOPSIS \fBgh event listen [flags]\fR .SH DESCRIPTION Listen to events on a pull request and print each event to stdout as it happens, as one CloudEvent JSON object per line. .PP Status messages go to stderr, so stdout carries only events. Use this to wait for changes instead of polling. .PP By default, the command exits after the first event. Use \fB--count\fR to exit after a number of events, or \fB--follow\fR to keep listening until it is stopped. Use \fB--timeout\fR to limit how long it listens. When the timeout is reached first, the command exits with status 8. .PP Pass a pull request URL with \fB--resource\fR and the event types to listen to with \fB--event\fR, repeating the flag or separating types with commas: .IP \(bu 2 \fBcom.github.pull_request.review.submitted.v1\fR: a review was submitted .IP \(bu 2 \fBcom.github.pull_request.state.changed.v1\fR: the pull request was merged, closed, reopened, marked ready for review, or converted to draft .IP \(bu 2 \fBcom.github.pull_request.head.changed.v1\fR: the head branch changed, for example after a push .IP \(bu 2 \fBcom.github.pull_request.merge_conflict.v1\fR: the pull request has a merge conflict .IP \(bu 2 \fBcom.github.pull_request.check_suite.status.changed.v1\fR: a check suite on the head commit completed, such as a CI workflow .PP Events are thin single line JSON objects with their \fBdata.api_url\fR pointing at the object that changed, such as the review, the pull request, or the check suite. Fetch it to learn what changed. .PP A pull request usually has several check suites, and each one sends its own event when it completes, with its \fBdata.conclusion\fR, such as \fBsuccess\fR or \fBfailure\fR\&. To wait for all checks, read the pull request checks after each event, for example with \fBgh pr checks\fR\&. .PP Use \fB--jq\fR or \fB--template\fR to format each event; see \fBgh help formatting\fR\&. .PP A status message is printed each time the event stream is attached. Earlier events are not replayed: only events that happen after that are delivered, so read the current state of the pull request once the message is printed, even if you read it before. .PP The command creates a subscription for the resource and event types, or reuses an existing one. Subscriptions expire after 24 hours, and each account can have a limited number of them at a time. To listen to an existing subscription, pass its ID with \fB--subscription\fR\&. .PP If the event stream breaks, the command reconnects. Events that happen while it is disconnected are not delivered. .PP Events are only available for pull requests on \fBgithub.com\fR, not on GitHub Enterprise Server or GHE.com. .SH OPTIONS .TP \fB--count\fR \fB (default 0)\fR Exit after this many events (default 1) .TP \fB--event\fR \fB\fR Event type to listen to; repeat or separate with commas for more than one .TP \fB--follow\fR Keep listening for events until stopped .TP \fB-q\fR, \fB--jq\fR \fB\fR Filter each event using a jq expression .TP \fB--resource\fR \fB\fR URL of the pull request to listen to .TP \fB--subscription\fR \fB\fR ID of an existing subscription to listen to .TP \fB-t\fR, \fB--template\fR \fB\fR Format each event using a Go template; see "gh help formatting" .TP \fB--timeout\fR \fB (default "0")\fR Exit with status 8 after this long, in seconds or as a duration such as 30s or 10m .SH EXIT CODES 0: Successful execution .PP 1: Error .PP 2: Command canceled .PP 4: Authentication required .PP NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information. .SH EXAMPLE .EX # Wait for the next review on a pull request, for up to 30 minutes $ gh event listen --resource https://github.com/OWNER/REPO/pull/123 --event com.github.pull_request.review.submitted.v1 --timeout 30m # Wait for a pull request to be merged or closed $ gh event listen --resource https://github.com/OWNER/REPO/pull/123 --event com.github.pull_request.state.changed.v1 # Wait for the next check suite to complete and print its conclusion $ gh event listen --resource https://github.com/OWNER/REPO/pull/123 --event com.github.pull_request.check_suite.status.changed.v1 --jq .data.conclusion # Keep printing reviews and state changes until stopped $ gh event listen --resource https://github.com/OWNER/REPO/pull/123 --follow --event com.github.pull_request.review.submitted.v1,com.github.pull_request.state.changed.v1 # Print the type and API URL of each event until stopped $ gh event listen --resource https://github.com/OWNER/REPO/pull/123 --follow --event com.github.pull_request.review.submitted.v1,com.github.pull_request.state.changed.v1 --jq '[.type, .data.api_url] | @tsv' .EE .SH SEE ALSO \fBgh-event(1)\fR