githubsetup

package
v0.153.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package githubsetup implements domain.GitHubSetupService for the GitHub Action CI setup flow. Every git/gh command runs through the injected CommandRunner under a 30-second timeout so a wedged subprocess cannot hang the UI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandRunner

type CommandRunner interface {
	Run(ctx context.Context, name string, args ...string) ([]byte, error)
}

CommandRunner is an injectable interface for running subprocesses. Tests supply a fake runner so no real gh/git calls are needed.

type RealRunner

type RealRunner struct{}

RealRunner shells out using exec.CommandContext.

func (*RealRunner) Run

func (r *RealRunner) Run(ctx context.Context, name string, args ...string) ([]byte, error)

Run returns stdout on success and stderr on failure, so callers that embed the bytes in an error surface the real git/gh diagnostic.

type Service

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

Service implements domain.GitHubSetupService.

func NewService

func NewService(runner CommandRunner) *Service

NewService creates a new Service with the given runner.

func (*Service) CheckOrgSecretsExist

func (s *Service) CheckOrgSecretsExist(orgName string) (bool, error)

CheckOrgSecretsExist checks whether INFER_APP_ID and INFER_APP_PRIVATE_KEY secrets exist for the given org.

func (*Service) GenerateGithubActionWorkflowContent

func (s *Service) GenerateGithubActionWorkflowContent() string

GenerateGithubActionWorkflowContent generates the GitHub App-based workflow YAML content with org-level secrets.

func (*Service) GenerateStandardWorkflowContent

func (s *Service) GenerateStandardWorkflowContent() string

GenerateStandardWorkflowContent generates the standard (github-actions[bot]) workflow YAML content.

func (*Service) GetCurrentRepo

func (s *Service) GetCurrentRepo() (string, error)

GetCurrentRepo returns the current GitHub repository name with owner.

func (*Service) IsOrgRepo

func (s *Service) IsOrgRepo(repo string) (bool, error)

IsOrgRepo checks whether the given repo belongs to a GitHub organization.

func (*Service) PreparePRCreation

func (s *Service) PreparePRCreation(repo, workflowPath string) (string, error)

PreparePRCreation creates a branch, commits the workflow file, pushes it, and opens a PR creation page. It returns the compare URL.

func (*Service) SetOrgSecret

func (s *Service) SetOrgSecret(orgName, name, value string) error

SetOrgSecret sets a GitHub organization-level secret.

func (*Service) WriteWorkflowFile

func (s *Service) WriteWorkflowFile(path, content string) error

WriteWorkflowFile writes the workflow content to the specified path.

Jump to

Keyboard shortcuts

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