Help us shape the future of Go! Take the 2026 Go Developer Survey

github

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package github collects an organization's team/member/repo/CODEOWNERS topology from the GitHub GraphQL API (CODEOWNERS file contents via REST) into a canonical, JSON-serializable model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps go-gh clients. raw fetches file contents with the raw Accept header (for CODEOWNERS). gql is used for all data collection queries.

func NewClient

func NewClient() (*Client, error)

NewClient builds a Client using the same auth as `gh` (token + host).

type Member

type Member struct {
	Login string `json:"login"`
	Role  string `json:"role"` // "maintainer" | "member"
}

type Options

type Options struct {
	Members    bool
	Codeowners bool
}

Options controls what Collect gathers.

type Org

type Org struct {
	Org         string `json:"org"`
	CollectedAt string `json:"collected_at"`
	Teams       []Team `json:"teams"`
}

Org is the canonical, hand-editable data model. Its JSON shape matches the legacy /gh-org-chart cache so existing <org>-org.json files remain readable.

func Collect

func Collect(c *Client, org string, opts Options) (*Org, error)

Collect gathers the org's teams, direct members (with role), and repos via a single nested, paginated GraphQL query.

type Repo

type Repo struct {
	Name           string   `json:"name"` // full name, "owner/repo"
	Archived       bool     `json:"archived"`
	Permission     string   `json:"permission"` // admin|maintain|push|triage|pull
	CodeownerPaths []string `json:"codeowner_paths,omitempty"`
}

type Team

type Team struct {
	Slug        string   `json:"slug"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Parent      *string  `json:"parent"` // parent team slug, or null
	Members     []Member `json:"members"`
	Repos       []Repo   `json:"repos"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL