| GH-EVENT-SUBSCRIPTION-CREATE(1) | GitHub CLI manual | GH-EVENT-SUBSCRIPTION-CREATE(1) |
NAME
gh-event-subscription-create - Create an event subscription (preview)
SYNOPSIS
gh event subscription create [flags]
DESCRIPTION
Create a subscription to events of the given types on a resource, without listening to it.
Pass the resource URL with --resource and the event types with --event, repeating the flag or separating types with commas:
- com.github.pull_request.review.submitted.v1: a review was submitted
- com.github.pull_request.state.changed.v1: the pull request was merged, closed, reopened, marked ready for review, or converted to draft
- com.github.pull_request.head.changed.v1: the head branch changed, for example after a push
- com.github.pull_request.merge_conflict.v1: the pull request has a merge conflict
- com.github.pull_request.check_suite.status.changed.v1: a check suite on the head commit completed, such as a CI workflow
Creating a subscription is idempotent: if an active subscription for the same resource and event types exists, it is returned instead.
Once successful, the command prints the subscription ID to stdout. Use gh event listen --subscription to receive its events. To create a subscription and listen to it in one step, use gh event listen --resource instead.
OPTIONS
- --event <type>
- Event type to subscribe to; repeat or separate with commas for more than one
- -q, --jq <expression>
- Filter JSON output using a jq expression
- --json <fields>
- Output JSON with the specified fields
- --resource <string>
- URL of the resource to subscribe to
- -t, --template <string>
- Format JSON output using a Go template; see "gh help formatting"
JSON FIELDS
createdAt, eventTypes, eventsUrl, expiresAt, id, resourceUrl, url
EXIT CODES
0: Successful execution
1: Error
2: Command canceled
4: Authentication required
NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information.
EXAMPLE
# Subscribe to reviews and state changes of a pull request $ gh event subscription create --resource https://github.com/OWNER/REPO/pull/123 --event com.github.pull_request.review.submitted.v1,com.github.pull_request.state.changed.v1
SEE ALSO
| Nov 2026 |