githubresolver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TokenFromEnv

func TokenFromEnv() string

func VerifyCommit

func VerifyCommit(ctx context.Context, owner, repo, sha string) error

Types

type ActionSelector

type ActionSelector struct {
	Owner string
	Repo  string
	Ref   string
}

type Client

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

func NewClient

func NewClient(options ...Option) (*Client, error)

func NewClientFromEnv

func NewClientFromEnv(options ...Option) (*Client, error)

func (*Client) Resolve

func (c *Client) Resolve(ctx context.Context, selector ActionSelector) (ResolvedRef, error)

func (*Client) ResolveBranch

func (c *Client) ResolveBranch(ctx context.Context, owner, repo, branch string) (ResolvedRef, error)

func (*Client) ResolveTag

func (c *Client) ResolveTag(ctx context.Context, owner, repo, tag string) (ResolvedRef, error)

func (*Client) VerifyCommit

func (c *Client) VerifyCommit(ctx context.Context, owner, repo, sha string) error

type ErrorKind

type ErrorKind string
const (
	ErrorInvalid   ErrorKind = "invalid"
	ErrorNotFound  ErrorKind = "not-found"
	ErrorForbidden ErrorKind = "forbidden"
	ErrorRateLimit ErrorKind = "rate-limit"
	ErrorGitHubAPI ErrorKind = "github-api"
)

type Option

type Option func(*clientOptions)

func WithBaseURL

func WithBaseURL(baseURL string) Option

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

func WithToken

func WithToken(token string) Option

type RefKind

type RefKind string
const (
	KindSHA    RefKind = "sha"
	KindTag    RefKind = "tag"
	KindBranch RefKind = "branch"
)

type ResolvedRef

type ResolvedRef struct {
	Owner       string     `json:"owner"`
	Repo        string     `json:"repo"`
	Ref         string     `json:"ref"`
	SHA         string     `json:"sha"`
	Kind        RefKind    `json:"kind"`
	CommitTime  time.Time  `json:"commit_time"`
	TagTime     *time.Time `json:"tag_time,omitempty"`
	ReleaseTime *time.Time `json:"release_time,omitempty"`
}

func Resolve

func Resolve(ctx context.Context, selector ActionSelector) (ResolvedRef, error)

func ResolveBranch

func ResolveBranch(ctx context.Context, owner, repo, branch string) (ResolvedRef, error)

func ResolveTag

func ResolveTag(ctx context.Context, owner, repo, tag string) (ResolvedRef, error)

type ResolverError

type ResolverError struct {
	Kind       ErrorKind
	Operation  string
	Owner      string
	Repo       string
	Ref        string
	StatusCode int
	Message    string
	Err        error
}

func (*ResolverError) Error

func (e *ResolverError) Error() string

func (*ResolverError) Unwrap

func (e *ResolverError) Unwrap() error

Jump to

Keyboard shortcuts

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