github

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package github collects an organization's team/member/repo/CODEOWNERS topology from the GitHub REST API 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 REST clients. rest decodes JSON; raw fetches file contents with the raw Accept header (for CODEOWNERS).

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, members (with role), and repos.

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