automation

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package automation implements the command-line interface and core logic for Librarian's automated workflows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, args []string) error

Run parses the command line arguments and triggers the specified command.

func RunCommand

func RunCommand(ctx context.Context, command string, projectId string, push bool, build bool) error

RunCommand triggers a command for each registered repository that supports it.

Types

type CloudBuildClient

type CloudBuildClient interface {
	RunBuildTrigger(ctx context.Context, req *cloudbuildpb.RunBuildTriggerRequest, opts ...gax.CallOption) error
	ListBuildTriggers(ctx context.Context, req *cloudbuildpb.ListBuildTriggersRequest, opts ...gax.CallOption) iter.Seq2[*cloudbuildpb.BuildTrigger, error]
}

CloudBuildClient is an interface for mocking calls to Cloud Build.

type GitHubClient

type GitHubClient interface {
	FindMergedPullRequestsWithPendingReleaseLabel(ctx context.Context, owner, repo string) ([]*github.PullRequest, error)
}

GitHubClient handles communication with the GitHub API.

type RepositoriesConfig

type RepositoriesConfig struct {
	ImageSHA     string              `yaml:"librarian-image-sha"`
	Repositories []*RepositoryConfig `yaml:"repositories"`
}

RepositoriesConfig represents all the registered librarian GitHub repositories.

func (*RepositoriesConfig) RepositoriesForCommand

func (c *RepositoriesConfig) RepositoriesForCommand(command string) []*RepositoryConfig

RepositoriesForCommand return a subset of repositories that support the provided command.

func (*RepositoriesConfig) Validate

func (c *RepositoriesConfig) Validate() error

Validate checks the RepositoriesConfig is valid.

type RepositoryConfig

type RepositoryConfig struct {
	Name              string   `yaml:"name"`
	FullName          string   `yaml:"full-name"`
	SecretName        string   `yaml:"github-token-secret-name"`
	SupportedCommands []string `yaml:"supported-commands"`

	// Branch configures the repository branch to checkout in Cloud Build prior
	// to command execution. Furthermore, it dictates the value set on the
	// [github.com/googleapis/librarian/internal/config.Config] Branch property
	// via the --branch flag.
	//
	// This property is optional. Downstream usage defaults to "main".
	Branch string `yaml:"branch"`
}

RepositoryConfig represents a single registered librarian GitHub repository.

func (*RepositoryConfig) GitURL

func (c *RepositoryConfig) GitURL() (string, error)

GitURL returns the full git url to clone. If full name is not available, it defaults to "https://github.com/googleapis/<name>".

func (*RepositoryConfig) Validate

func (c *RepositoryConfig) Validate() error

Validate checks the RepositoryConfig is valid.

Jump to

Keyboard shortcuts

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