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

github

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package github provides a client for syncing compliance findings with GitHub issues.

It wraps go-github to:

  • Create tracking issues for findings
  • Discover linked issues/PRs from comments
  • Sync issue state back to finding status
  • Collect evidence from closed issues/PRs (merge info)

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 the GitHub API for compliance operations.

func NewWithToken

func NewWithToken(ctx context.Context, token string) *Client

NewWithToken creates a Client with an explicit token.

func (*Client) AddLabels added in v0.6.0

func (c *Client) AddLabels(ctx context.Context, repo string, number int, labels []string) error

AddLabels adds labels to an existing issue.

func (*Client) CreateIssue

func (c *Client) CreateIssue(ctx context.Context, repo, title, body string, labels []string) (int, error)

CreateIssue creates a new GitHub issue and returns the issue number.

func (c *Client) DiscoverCommentLinks(ctx context.Context, repo string, number int) ([]IssueRef, []IssueRef, error)

DiscoverCommentLinks finds issue/PR references in comments on a tracking issue. Returns (issues, prs) that are not self-references.

func (*Client) EnsureLabels

func (c *Client) EnsureLabels(ctx context.Context, repo string, labels map[string]string) error

EnsureLabels creates labels that don't exist yet.

func (*Client) GetIssueClosedAt added in v0.10.0

func (c *Client) GetIssueClosedAt(ctx context.Context, repo string, number int) (string, error)

GetIssueClosedAt returns the closed_at date for a closed issue. Returns ("", nil) if the issue is not closed.

func (*Client) GetIssueState

func (c *Client) GetIssueState(ctx context.Context, repo string, number int) (*IssueState, error)

GetIssueState fetches the state of a single issue.

func (*Client) GetPRMergeInfo

func (c *Client) GetPRMergeInfo(ctx context.Context, repo string, number int) (bool, string, string, error)

GetPRMergeInfo returns merge metadata for a pull request. Returns (merged bool, mergedAt string, mergeCommitSHA string, err).

type IssueRef

type IssueRef struct {
	Repo   string
	Number int
}

IssueRef is a (repo, number) pair.

type IssueState

type IssueState struct {
	Number      int
	State       string // OPEN, CLOSED
	StateReason string // COMPLETED, NOT_PLANNED, REOPENED
	Labels      []string
	MergedAt    string // for PRs only
}

IssueState holds the state of a GitHub issue relevant to compliance sync.

Jump to

Keyboard shortcuts

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