github

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package github adapts the GitHub Projects v2 client (internal/api) to the source.Source interface: it resolves the viewer, aggregates user and org projects, applies the config include/exclude filters, and loads boards.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Orgs           []string // additional orgs to include beyond discovered memberships
	IgnoreOrgs     []string
	IgnoreProjects []string
	OnlyOrgs       []string
	OnlyProjects   []string
}

Options configures which projects the GitHub source exposes. They mirror the config Defaults so the source owns all GitHub-specific listing policy.

type Source

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

Source is the GitHub Projects v2 backend.

func New

func New(opts Options) (*Source, error)

New builds the GitHub source from the current gh auth context. It resolves the viewer login and merges discovered org memberships with configured orgs. It performs network calls, so it fails when gh is unauthenticated or offline.

func (*Source) Caps

func (s *Source) Caps() source.Capabilities

Caps reports GitHub's capabilities: comment, close/reopen and card moves (single-select field edits) when the gh binary is present.

func (*Source) Comment

func (s *Source) Comment(item core.Card, body string) error

Comment adds a comment to the underlying issue or pull request.

func (*Source) CreateIssue

func (s *Source) CreateIssue(string, source.Draft) (core.Card, error)

func (*Source) GetBoard

func (s *Source) GetBoard(projectID string) (*core.BoardData, error)

GetBoard loads a project's board from GitHub and caches its field/option ids so a later card move can resolve names back to ids.

func (*Source) ListProjects

func (s *Source) ListProjects() ([]core.Project, error)

ListProjects returns the viewer's projects plus the effective orgs' projects, filtered by the configured include/exclude lists.

func (*Source) Name

func (s *Source) Name() string

Name identifies this backend.

func (*Source) SetAssignees

func (s *Source) SetAssignees(core.Card, []string) error

func (*Source) SetField

func (s *Source) SetField(item core.Card, field, option string) error

SetField moves a card to a single-select option — the GitHub equivalent of dragging it to another board column — via `gh project item-edit`. It resolves the project/field/option ids from the cache populated by the last GetBoard.

func (*Source) SetLabels

func (s *Source) SetLabels(core.Card, []string) error

func (*Source) SetState

func (s *Source) SetState(item core.Card, state string) error

SetState closes or reopens the underlying issue or pull request.

Jump to

Keyboard shortcuts

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