source

package
v3.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package source provides a tools to use version control systems.

Package source provides a tools to use version control systems.

Index

Constants

View Source
const (
	// RepoDir defines a directory to clone and extract repository.
	RepoDir = "/tmp/ci_checker"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Type  string `yaml:"type"`
	Token string `yaml:"token"`
}

Config describes the configuration of the plugged version control system.

type GHProvider

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

GHProvider declares GitHub code provider.

func NewCodeProvider

func NewCodeProvider(ctx context.Context, cfg *Config) *GHProvider

NewCodeProvider create a new code provider

func (*GHProvider) Download

func (cp *GHProvider) Download(ctx context.Context, opts Opts, outputFile string) error

Download downloads repository.

func (*GHProvider) Extract

func (cp *GHProvider) Extract(file string) (string, error)

Extract extracts downloaded repository archive.

type Opts

type Opts struct {
	Owner       string `json:"owner"`
	Repo        string `json:"repo"`
	Ref         string `json:"ref"`
	Branch      string `json:"branch"`
	BranchLink  string `json:"branch_link"`
	Commit      string `json:"commit"`
	CommitLink  string `json:"commit_link"`
	RequestLink string `json:"request_link"`
	DiffLink    string `json:"diff_link"`
}

Opts declares repository options.

type Provider

type Provider interface {
	Download(ctx context.Context, opts Opts, output string) error
	Extract(file string) (sourceCodeDir string, err error)
}

Provider declares code provider interface.

Jump to

Keyboard shortcuts

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