repository

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	Id        int64  `json:"id"`
	Login     string `json:"login"`
	AvatarUrl string `json:"avatar_url"`
}

type GithubBranch

type GithubBranch struct {
	Name string `json:"name"`
}

type GithubConfig

type GithubConfig struct {
	Token string
}

type GithubRepository

type GithubRepository struct {
	Id              int         `json:"id"`
	NodeId          string      `json:"node_id"`
	Name            string      `json:"name"`
	FullName        string      `json:"full_name"`
	Private         bool        `json:"private"`
	Description     string      `json:"description"`
	Language        interface{} `json:"language"`
	ForksCount      int         `json:"forks_count"`
	StargazersCount int         `json:"stargazers_count"`
	WatchersCount   int         `json:"watchers_count"`
	Size            int         `json:"size"`
	DefaultBranch   string      `json:"default_branch"`
	OpenIssuesCount int         `json:"open_issues_count"`
	IsTemplate      bool        `json:"is_template"`
	Topics          []string    `json:"topics"`
	HasIssues       bool        `json:"has_issues"`
	HasProjects     bool        `json:"has_projects"`
	HasWiki         bool        `json:"has_wiki"`
	HasPages        bool        `json:"has_pages"`
	HasDownloads    bool        `json:"has_downloads"`
	Archived        bool        `json:"archived"`
	Disabled        bool        `json:"disabled"`
	Visibility      string      `json:"visibility"`
	PushedAt        time.Time   `json:"pushed_at"`
	CreatedAt       time.Time   `json:"created_at"`
	UpdatedAt       time.Time   `json:"updated_at"`
	Permissions     struct {
		Admin bool `json:"admin"`
		Push  bool `json:"push"`
		Pull  bool `json:"pull"`
	} `json:"permissions"`
	AllowRebaseMerge    bool        `json:"allow_rebase_merge"`
	TemplateRepository  interface{} `json:"template_repository"`
	TempCloneToken      string      `json:"temp_clone_token"`
	AllowSquashMerge    bool        `json:"allow_squash_merge"`
	AllowAutoMerge      bool        `json:"allow_auto_merge"`
	DeleteBranchOnMerge bool        `json:"delete_branch_on_merge"`
	AllowMergeCommit    bool        `json:"allow_merge_commit"`
	SubscribersCount    int         `json:"subscribers_count"`
	NetworkCount        int         `json:"network_count"`
	License             struct {
		Key     string `json:"key"`
		Name    string `json:"name"`
		Url     string `json:"url"`
		SpdxId  string `json:"spdx_id"`
		NodeId  string `json:"node_id"`
		HtmlUrl string `json:"html_url"`
	} `json:"license"`
	Forks      int `json:"forks"`
	OpenIssues int `json:"open_issues"`
	Watchers   int `json:"watchers"`
}

type GithubWorkflowRunLogs

type GithubWorkflowRunLogs struct {
	TotalSize int    `json:"total_size"`
	Url       string `json:"url"`
	Download  string `json:"download_url"`
}

type HttpClient

type HttpClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type InitializeOptions

type InitializeOptions struct {
	HTTPTimeout time.Duration
}

type Repo

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

func New

func New(cfg *pkgconfig.Config) *Repo

func (*Repo) CancelWorkflow

func (r *Repo) CancelWorkflow(ctx context.Context, repository string, runId int64) error

func (*Repo) GetRepository

func (r *Repo) GetRepository(ctx context.Context, repository string) (*GithubRepository, error)

func (*Repo) GetTriggerableWorkflows

func (r *Repo) GetTriggerableWorkflows(ctx context.Context, repository string) ([]Workflow, error)

func (*Repo) GetWorkflowRunLogs

func (r *Repo) GetWorkflowRunLogs(ctx context.Context, repository string, runId int64) (GithubWorkflowRunLogs, error)

func (*Repo) GetWorkflows

func (r *Repo) GetWorkflows(ctx context.Context, repository string) ([]Workflow, error)

func (*Repo) InspectWorkflowContent

func (r *Repo) InspectWorkflowContent(ctx context.Context, repository string, branch string, workflowFile string) ([]byte, error)

func (*Repo) ListBranches

func (r *Repo) ListBranches(ctx context.Context, repository string) ([]GithubBranch, error)

func (*Repo) ListRepositories

func (r *Repo) ListRepositories(ctx context.Context, limit int) ([]GithubRepository, error)

func (*Repo) ListWorkflowRuns

func (r *Repo) ListWorkflowRuns(ctx context.Context, repository string, branch string) (*WorkflowRuns, error)

func (*Repo) ReRunFailedJobs

func (r *Repo) ReRunFailedJobs(ctx context.Context, repository string, runId int64) error

func (*Repo) ReRunWorkflow

func (r *Repo) ReRunWorkflow(ctx context.Context, repository string, runId int64) error

func (*Repo) TestConnection

func (r *Repo) TestConnection(ctx context.Context) error

func (*Repo) TriggerWorkflow

func (r *Repo) TriggerWorkflow(ctx context.Context, repository string, branch string, workflowName string, workflow any) error

type Repository

type Repository interface {
	TestConnection(ctx context.Context) error
	ListRepositories(ctx context.Context, limit int) ([]GithubRepository, error)
	GetRepository(ctx context.Context, repository string) (*GithubRepository, error)
	ListBranches(ctx context.Context, repository string) ([]GithubBranch, error)
	ListWorkflowRuns(ctx context.Context, repository string, branch string) (*WorkflowRuns, error)
	TriggerWorkflow(ctx context.Context, repository string, branch string, workflowName string, workflow any) error
	GetWorkflows(ctx context.Context, repository string) ([]Workflow, error)
	GetTriggerableWorkflows(ctx context.Context, repository string) ([]Workflow, error)
	InspectWorkflowContent(ctx context.Context, repository string, branch string, workflowFile string) ([]byte, error)
	GetWorkflowRunLogs(ctx context.Context, repository string, runId int64) (GithubWorkflowRunLogs, error)
	ReRunFailedJobs(ctx context.Context, repository string, runId int64) error
	ReRunWorkflow(ctx context.Context, repository string, runId int64) error
	CancelWorkflow(ctx context.Context, repository string, runId int64) error
}

type Workflow

type Workflow struct {
	ID        int64     `json:"id"`
	Name      string    `json:"name"`
	Path      string    `json:"path"`
	State     string    `json:"state"`
	UpdatedAt time.Time `json:"updated_at"`
	Url       string    `json:"url"`
	HtmlUrl   string    `json:"html_url"`
}

type WorkflowRun

type WorkflowRun struct {
	ID              int64     `json:"id"`
	WorkflowID      int64     `json:"workflow_id"`
	Name            string    `json:"name"`
	DisplayTitle    string    `json:"display_title"`
	Actor           Actor     `json:"actor"`
	TriggeringActor Actor     `json:"triggering_actor"`
	Status          string    `json:"status"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
	Conclusion      string    `json:"conclusion"`
	HeadBranch      string    `json:"head_branch"`

	RunAttempt    int    `json:"run_attempt"`
	CheckSuiteURL string `json:"check_suite_url"`
	CancelURL     string `json:"cancel_url"`
	RerunURL      string `json:"rerun_url"`
	Path          string `json:"path"`
	Event         string `json:"event"`
	HTMLURL       string `json:"html_url"`
	LogsURL       string `json:"logs_url"`
	JobsURL       string `json:"jobs_url"`
	ArtifactsURL  string `json:"artifacts_url"`
}

type WorkflowRuns

type WorkflowRuns struct {
	TotalCount   int64         `json:"total_count"`
	WorkflowRuns []WorkflowRun `json:"workflow_runs"`
}

Jump to

Keyboard shortcuts

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