Skip to content

Event streaming (3/11): Add gh event subscription list - #15073

Merged
BagToad merged 1 commit into
babakks/event-listenfrom
babakks/event-sub-list
Nov 17, 2026
Merged

BagToad merged 1 commit into
babakks/event-listenfrom
babakks/event-sub-list

Conversation

@babakks

@babakks babakks commented Nov 17, 2026

Copy link
Copy Markdown
Member

Layer 3 of 11 in the stack tracked by #15070.

Description

Each account can hold a limited number of active event subscriptions, and gh event listen does not delete its subscription on exit, because another listener may share it. Users need a way to see what they hold, especially when a new subscription is rejected at the limit.

This PR adds the gh event subscription group, marked as preview, with its first command:

gh event subscription list [--limit N] [--json FIELDS]

It lists the caller's active subscriptions, newest first, following pagination up to --limit (default 30). On a terminal it prints a header and a table of ID, resource, event types, and a relative expiry; otherwise it prints tab-separated rows with comma-joined event types and RFC 3339 expiry times. --json exports id, resourceUrl, eventTypes, createdAt, expiresAt, url, and eventsUrl. With no subscriptions it reports "no event subscriptions" like other list commands.

How did you test this change?

Recording of gh event subscription list: the no results message after deleting existing subscriptions, a table on a terminal after creating two subscriptions on babakks#17, plain lines when piped, and --json output.

03-sub-list.mp4

With a gh built from the complete stack, I ran the live smoke check from the evals PR against a sandbox pull request on github.com. Among other steps, it ran gh event subscription create with a merge conflict event type and got a sub_... ID on stdout, saw the same ID, resource URL, and event types in gh event subscription view ID --json id,resourceUrl,eventTypes, found the ID in gh event subscription list --limit 100 --json id, ran gh event subscription delete ID, and then saw gh event subscription view ID fail because the subscription was gone.

Key points

  • The API reports no total count, so the header says "Showing the N most recent event subscriptions" when the page is full, rather than claiming a total.
  • list uses the default host, since subscriptions are per account rather than per repository.

Notes for reviewers

Stack, bottom to top (this is 3 of 11, based on babakks/event-listen): babakks/event-client, babakks/event-listen, babakks/event-sub-list, babakks/event-sub-create, babakks/event-sub-view, babakks/event-sub-delete, babakks/event-hints, babakks/event-evals, babakks/event-listen-flush, babakks/event-listen-deleted-sub, babakks/event-check-suite.

Start with pkg/cmd/event/subscription/list/list.go. subscription.go adds the group; the next three PRs each register one more command in it.

Authorship and follow-up

Who wrote this:

  • A human wrote it.
  • An agent wrote it under close human direction.
  • An agent wrote it independently, and no human has guided the implementation beyond the initial prompt.

Who answers review comments:

  • @babakks will read and reply directly. Name the account.
  • An agent will draft replies and @username will read them before they are posted.
  • Nobody has explicitly committed to replying.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: bbce5a7f-103c-4e67-99c9-2d6dc3f6a02b
@babakks
babakks requested a review from a team as a code owner November 17, 2026 17:11
@babakks
babakks requested review from a team and niik and a balanced review from Copilot and removed request for a team November 17, 2026 17:11
@babakks
babakks added this pull request to stack #15082 November 17, 2026 17:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Tests lack a non-github.com default-host case verifying the host passed to the event-client factory and factory-error propagation without output.

1 open issue
What changed in this PR

Adds gh event subscription list as the first subscription-management command in the event-streaming stack, helping users inspect active subscriptions and account limits.

Changes:

  • Registers the preview event subscription command group.
  • Adds listing with a default limit of 30, terminal tables, tab-separated output, and JSON export.
  • Adds tests for flags, output formats, empty results, and API errors.
File Description
pkg/​cmd/​event/​subscription/​subscription.go Defines the preview subscription group and registers list.
pkg/​cmd/​event/​subscription/​list/​list.go Implements listing, default-host selection, limits, and output formats.
pkg/​cmd/​event/​subscription/​list/​list_test.go Tests command options, rendering, JSON fields, and error handling.
pkg/​cmd/​event/​event.go Registers the subscription group under gh event.

Review effort: Balanced

@babakks
babakks requested review from BagToad and removed request for a team and niik November 17, 2026 17:15
@BagToad
BagToad merged commit 42d52b4 into trunk Nov 17, 2026
19 checks passed
@BagToad
BagToad deleted the babakks/event-sub-list branch November 17, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants