github

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadInstances

func LoadInstances(dir string) ([]tracker.Instance, error)

LoadInstances reads config, applies env overrides, creates clients, and returns ready-to-use tracker instances.

Types

type Client

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

Client is a GitHub REST API client that implements tracker.Lister, tracker.Getter, and tracker.Creator.

func New

func New(baseURL, token string) *Client

New creates a GitHub client with the given base URL and personal access token.

func (*Client) AddComment

func (c *Client) AddComment(ctx context.Context, issueKey string, body string) (*tracker.Comment, error)

AddComment implements tracker.Commenter.

func (*Client) AssignIssue

func (c *Client) AssignIssue(ctx context.Context, key string, userID string) error

AssignIssue implements tracker.Assigner.

func (*Client) CreateIssue

func (c *Client) CreateIssue(ctx context.Context, issue *tracker.Issue) (*tracker.Issue, error)

CreateIssue implements tracker.Creator.

func (*Client) DeleteIssue

func (c *Client) DeleteIssue(ctx context.Context, key string) error

DeleteIssue implements tracker.Deleter by closing the issue. GitHub does not support true deletion via the API, so we close the issue instead.

func (*Client) EditIssue

func (c *Client) EditIssue(ctx context.Context, key string, opts tracker.EditOptions) (*tracker.Issue, error)

EditIssue implements tracker.Editor.

func (*Client) GetCurrentUser

func (c *Client) GetCurrentUser(ctx context.Context) (string, error)

GetCurrentUser implements tracker.CurrentUserGetter.

func (*Client) GetIssue

func (c *Client) GetIssue(ctx context.Context, key string) (*tracker.Issue, error)

GetIssue implements tracker.Getter.

func (*Client) ListComments

func (c *Client) ListComments(ctx context.Context, issueKey string) ([]tracker.Comment, error)

ListComments implements tracker.Commenter.

func (*Client) ListIssues

func (c *Client) ListIssues(ctx context.Context, opts tracker.ListOptions) ([]tracker.Issue, error)

ListIssues implements tracker.Lister.

func (*Client) ListStatuses

func (c *Client) ListStatuses(_ context.Context, _ string) ([]tracker.Status, error)

ListStatuses implements tracker.StatusLister. GitHub issues have fixed states: open and closed.

func (*Client) SetHTTPDoer

func (c *Client) SetHTTPDoer(doer tracker.HTTPDoer)

SetHTTPDoer replaces the HTTP client used for API requests.

func (*Client) TransitionIssue

func (c *Client) TransitionIssue(ctx context.Context, key string, targetStatus string) error

TransitionIssue implements tracker.Transitioner.

type Config

type Config struct {
	Name        string `mapstructure:"name"`
	URL         string `mapstructure:"url"`
	Token       string `mapstructure:"token"`
	Description string `mapstructure:"description"`
	Safe        bool   `mapstructure:"safe"`
}

Config holds the configuration for a single GitHub instance.

func LoadConfigs

func LoadConfigs(dir string) ([]Config, error)

LoadConfigs reads a .humanconfig YAML file from dir and returns the list of configured GitHub instances. Returns nil and no error if the file does not exist.

Jump to

Keyboard shortcuts

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