github

package
v0.0.0-...-b36415e Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncryptSecretValue

func EncryptSecretValue(ctx context.Context, client Client, owner, repo, secretValue string) ([]byte, error)

EncryptSecretValue encrypts a plaintext secret value for a repository.

Types

type Client

type Client interface {
	// Repository Secrets
	GetPublicKey(ctx context.Context, owner, repo string) (*PublicKey, error)
	SetRepositorySecret(ctx context.Context, owner, repo, name, secretValue string) error
	GetRepositorySecret(ctx context.Context, owner, repo, name string) (*SecretMetadata, error)

	// Environment Secrets
	GetEnvironmentPublicKey(ctx context.Context, owner, repo, environment string) (*PublicKey, error)
	SetEnvironmentSecret(ctx context.Context, owner, repo, environment, name, secretValue string) error
	GetEnvironmentSecret(ctx context.Context, owner, repo, environment, name string) (*SecretMetadata, error)

	// Repository Variables
	SetRepositoryVariable(ctx context.Context, owner, repo, name, value string) error
	GetRepositoryVariable(ctx context.Context, owner, repo, name string) (*VariableMetadata, error)

	// Environment Variables
	SetEnvironmentVariable(ctx context.Context, owner, repo, environment, name, value string) error
	GetEnvironmentVariable(ctx context.Context, owner, repo, environment, name string) (*VariableMetadata, error)

	// Helper methods
	GetRepositoryID(ctx context.Context, owner, repo string) (int64, error)

	// Legacy methods (for backward compatibility during migration)
	SetSecret(ctx context.Context, owner, repo, name, secretValue string) error
	GetSecret(ctx context.Context, owner, repo, name string) (*SecretMetadata, error)
}

Client is the interface for GitHub API operations.

func NewClient

func NewClient(token string) Client

NewClient creates a new GitHub client.

type EnvironmentNotFoundError

type EnvironmentNotFoundError struct {
	Owner       string
	Repo        string
	Environment string
}

EnvironmentNotFoundError represents an error when an environment is not found.

func (*EnvironmentNotFoundError) Error

func (e *EnvironmentNotFoundError) Error() string

type PublicKey

type PublicKey struct {
	KeyID string
	Key   string
}

PublicKey represents a GitHub repository's public key for secrets encryption.

type RepositoryNotFoundError

type RepositoryNotFoundError struct {
	Owner string
	Repo  string
}

RepositoryNotFoundError represents an error when a repository is not found.

func (*RepositoryNotFoundError) Error

func (e *RepositoryNotFoundError) Error() string

type SecretError

type SecretError struct {
	Type        string // "repository_secret", "environment_secret"
	Owner       string
	Repo        string
	Environment string // optional, empty for repository secrets
	Name        string
	Err         error
}

SecretError represents an error related to secret operations.

func (*SecretError) Error

func (e *SecretError) Error() string

func (*SecretError) Unwrap

func (e *SecretError) Unwrap() error

type SecretMetadata

type SecretMetadata struct {
	Name      string
	CreatedAt string
	UpdatedAt string
}

SecretMetadata represents metadata about a secret.

type VariableError

type VariableError struct {
	Type        string // "repository_variable", "environment_variable"
	Owner       string
	Repo        string
	Environment string // optional, empty for repository variables
	Name        string
	Err         error
}

VariableError represents an error related to variable operations.

func (*VariableError) Error

func (e *VariableError) Error() string

func (*VariableError) Unwrap

func (e *VariableError) Unwrap() error

type VariableMetadata

type VariableMetadata struct {
	Name      string
	Value     string
	CreatedAt string
	UpdatedAt string
}

VariableMetadata represents metadata about a variable.

Jump to

Keyboard shortcuts

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