Repository navigation
fix(event): link Event Streams docs when preview access is denied - #15206
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the change adding documentation guidance to preview-access errors.
No open issues 🎉
What changed in this PR
This PR gives users denied access to the Event Streams preview a next step by adding a documentation link to the shared gh event error handler.
Changes:
- Append a docs link explaining how to join the preview waitlist while preserving wrapped errors.
- Recognize preview-denial messages case-insensitively and with surrounding text.
- Extend tests to cover message variations and verify the docs hint on preview-access errors.
| File | Description |
|---|---|
pkg/cmd/event/client/client.go |
Adds the preview docs hint and more tolerant denial-message matching. |
pkg/cmd/event/client/client_test.go |
Tests message variations and the docs hint on preview-denial errors. |
Review effort: Balanced
BagToad
approved these changes
Dec 1, 2026
BagToad
left a comment
Member
There was a problem hiding this comment.
A couple conciseness suggestions
babakks
enabled auto-merge
December 1, 2026 16:56
When the API rejects a request because the account is not enrolled in the Event Streams preview, end the error with a short link to the Event Streams docs, which include the waitlist signup link. Recognize the denial by its EventSubscription not_enabled error item, and fall back to matching the API message case-insensitively as a substring for responses without the item, so changes in casing or surrounding text do not hide the hint. Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bbce5a7f-103c-4e67-99c9-2d6dc3f6a02b
babakks
force-pushed
the
babakks/event-preview-docs-hint
branch
from
December 1, 2026 17:06
9f8d488 to
c93d922
Compare
BagToad
approved these changes
Dec 1, 2026
bartsmykla
added a commit
to bartsmykla/hubdouble
that referenced
this pull request
Dec 2, 2026
The repository list ordered events of the same second by ID, but a merge's `merged` and `closed` are synthesized with the pull request's ID and the issue's ID, and the pull request's ID is the larger one, so the list put `merged` above `closed`. Live GitHub records `merged` first (`gh api repos/cli/cli/issues/15206/events`: 37857879021 merged and 37857879337 closed, both 2026-12-01T17:14:29Z), so its newest-first list shows `closed` above `merged`. Events of one second now keep the reverse of their issue's own list order, and issues tie by ID. The limit of the list gets its own name beside the repository comment list whose values it shares. The events test now merges the pull request and checks that each issue's list, reversed, is its part of the repository list, and the permission test reads a real event ID. Signed-off-by: Bart Smykla <bartek@smykla.com>
bartsmykla
added a commit
to bartsmykla/hubdouble
that referenced
this pull request
Dec 2, 2026
The repository list ordered events of the same second by ID, but a merge's `merged` and `closed` are synthesized with the pull request's ID and the issue's ID, and the pull request's ID is the larger one, so the list put `merged` above `closed`. Live GitHub records `merged` first (`gh api repos/cli/cli/issues/15206/events`: 37857879021 merged and 37857879337 closed, both 2026-12-01T17:14:29Z), so its newest-first list shows `closed` above `merged`. Events of one second now keep the reverse of their issue's own list order, and issues tie by ID. The limit of the list gets its own name beside the repository comment list whose values it shares. The events test now merges the pull request and checks that each issue's list, reversed, is its part of the repository list, and the permission test reads a real event ID. Signed-off-by: Bart Smykla <bartek@smykla.com>
bartsmykla
added a commit
to bartsmykla/hubdouble
that referenced
this pull request
Dec 2, 2026
The repository list ordered events of the same second by ID, but a merge's `merged` and `closed` are synthesized with the pull request's ID and the issue's ID, and the pull request's ID is the larger one, so the list put `merged` above `closed`. Live GitHub records `merged` first (`gh api repos/cli/cli/issues/15206/events`: 37857879021 merged and 37857879337 closed, both 2026-12-01T17:14:29Z), so its newest-first list shows `closed` above `merged`. Events of one second now keep the reverse of their issue's own list order, and issues tie by ID. The limit of the list gets its own name beside the repository comment list whose values it shares. The events test now merges the pull request and checks that each issue's list, reversed, is its part of the repository list, and the permission test reads a real event ID. Signed-off-by: Bart Smykla <bartek@smykla.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Event Streams is in preview, so the API answers every
gh eventrequest from an account that isn't enrolled with a 403 and the message "Event subscriptions are not enabled for this account".ghalready recognizes that response and says the account isn't enabled, but it leaves the user (or the agent runninggh) with no next step.This adds a final line to that error pointing to the Event Streams documentation, which explains the preview and links to the waitlist signup:
The check that recognizes the preview response is also more robust now. It first looks for an error item with resource
EventSubscriptionand codenot_enabled, which the API is adding to this 403 so clients don't have to depend on the message text. For responses without that item, it falls back to the message, matched case-insensitively and as a substring, so a change in casing or surrounding text (such as a trailing period) doesn't silently drop the hint.How did you test this change?
I built
ghfromtrunkand from this branch and ran both against a local mock API that answersPOST /event-subscriptionsandGET /event-subscriptionswith a 403 and the preview message.Given the account isn't enrolled in the preview
When I ran
gh event listen --resource https://github.com/example.invalid/hello/pull/1 --event pull_requestThen both builds exited 1, and only this branch ended the error with the docs line:
Given the same account
When I ran
gh event subscription listThen both builds exited 1, and only this branch ended the error with the same docs line:
I then changed the mock 403 to include the
{"resource":"EventSubscription","code":"not_enabled"}error item and replaced its message with a generic "Forbidden", so only the error item identifies the preview response.Given the account isn't enrolled and the 403 carries only the error item
When I ran
gh event subscription listwith this branchThen it exited 1 and still recognized the preview response and printed the docs line:
The
EventSubscription. not_enabledline comes from the shared API error formatting, which adds each error item to the message.I also confirmed that
https://gh.io/event-streams-docsredirects to https://docs.github.com/integrations/how-tos/using-github-event-streams.Key points
forbiddenError, which everygh eventcommand goes through, solistenand allsubscriptioncommands get it without per-command changes.%w\nTo ...pattern used for the subscription limit hint, soerrors.Is(err, client.ErrPreviewNotEnabled)and the wrappedapi.HTTPErrorare unchanged.gh.ioshort link rather than the full docs URL. It keeps the output short, which matters when agents read it, and it can be redirected if the docs move without a newghrelease.Errorsfield thatapi.HTTPErroralready parses, so no extra response parsing is needed. The message fallback keepsghworking against API responses that don't carry the item yet.Notes for reviewers
Start with
forbiddenError,isPreviewNotEnabledand the constants next topreviewNotEnabledMessageinpkg/cmd/event/client/client.go. The test changes inclient_test.goadd a reworded, upper-case message case, an error item case with a generic message, a case where a different error code stays a generic forbidden error, and assert the docs line on every preview-access case.The commands that print the
gh event listenhint (such asgh pr view) are not changed; they still only mention that the preview may not be enabled.Authorship and follow-up
Who wrote this:
Who answers review comments: