Skip to content

Support enumerating the known event types #2863

@evankanderson

Description

@evankanderson

It looks like go-github has an internal list of all the GitHub event types . I'd like to be able to iterate over the list in my own code where I route events based on event type. I'm thinking of exposing the following methods:

// WebhookTypes returns a list of all the known GitHub event type strings supported by go-github.
func WebhookTypes() []string {
  // ...
}

// EventForType returns an empty struct matching the specified GitHub event type.
func EventForType(messageType string) any {

}

The second method would extract a lot of Event.ParsePayload https://github.com/google/go-github/blob/master/github/event.go#L30, so it wouldn't be much additional code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions