Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Executor
}
Client executes secret operations via the gh CLI. Executor is embedded so methods like ExecContext are promoted directly onto Client.
func NewClient ¶
NewClient returns a Client, verifying that the gh CLI is available. Pass functional options to override defaults (e.g. WithExecutor for tests).
func (*Client) CurrentRepository ¶ added in v0.2.0
CurrentRepository returns the current GitHub repository in owner/repo format.
func (*Client) UpsertRepoSecret ¶
func (c *Client) UpsertRepoSecret(ctx context.Context, req UpsertSecretRequest) error
UpsertRepoSecret sets a secret on a repository by delegating to the gh CLI.
type Executor ¶
type Executor interface {
// Path returns the path to the gh binary, or an error if not found.
Path() (string, error)
// ExecContext invokes a gh subcommand and returns its stdout and stderr.
ExecContext(ctx context.Context, args ...string) (stdout, stderr bytes.Buffer, err error)
}
Executor abstracts the gh CLI subprocess calls so the Client can be unit-tested.
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithExecutor ¶
WithExecutor replaces the default gh CLI executor. Primarily for testing.
type UpsertSecretRequest ¶
UpsertSecretRequest holds the data needed to upsert one secret to one repo. Repo must be in "owner/repo" format.
func (UpsertSecretRequest) Validate ¶
func (r UpsertSecretRequest) Validate() error
Validate checks that the request has all required fields.