github

package
v1.0.1-0...-fe66d50 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Type = "github"

Type should match the package name

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage struct {
	// AccessToken is the API token used to authenticate with GitHub (required).
	AccessToken string `json:"access_token"`

	// RepositoryOwner is the account which owns the repository on GitHub (required).
	// For https://github.com/octocat/kit, the owner is "octocat".
	RepositoryOwner string `json:"repository_owner"`

	// RepositoryName is the name of the repository on GitHub (required).
	// For https://github.com/octocat/kit, the name is "kit".
	RepositoryName string `json:"repository_name"`

	// CommitterName is the display name of the user corresponding to the AccessToken (required).
	// If the AccessToken is for user @octocat, then this might be "Mona Lisa," her name.
	CommitterName string `json:"committer_name"`

	// CommitterEmail is the email address of the user corresponding to the AccessToken (required).
	// If the AccessToken is for user @octocat, then this might be "mona@github.com".
	CommitterEmail string `json:"committer_email"`

	// Branch is the git branch to store the files to (required).
	Branch string `json:"branch"`

	// Dir is the subdirectory in the Git tree in which to store the files (required).
	// For example, to write to the directory "updates" in the Git repo, this should be "updates".
	Dir string `json:"dir"`

	// Check files older than CheckExpiry will be
	// deleted on calls to Maintain(). If this is
	// the zero value, no old check files will be
	// deleted.
	CheckExpiry time.Duration `json:"check_expiry,omitempty"`

	// CommitMessageSuffix is a string appended to each commit message.
	// It could contain something like "[ci skip]" to prevent commits
	// from triggering automated CI/CD pipelines.
	CommitMessageSuffix string `json:"commit_message_suffix"`
	// contains filtered or unexported fields
}

Storage is a way to store checkup results in a GitHub repository.

func New

func New(config json.RawMessage) (*Storage, error)

New creates a new Storage instance based on json config

func (*Storage) Fetch

func (gh *Storage) Fetch(name string) ([]types.Result, error)

Fetch returns a checkup record -- Not tested!

func (*Storage) GetIndex

func (gh *Storage) GetIndex() (map[string]int64, error)

GetIndex returns the checkup index

func (*Storage) Maintain

func (gh *Storage) Maintain() error

Maintain deletes check files that are older than gh.CheckExpiry.

func (*Storage) Store

func (gh *Storage) Store(results []types.Result) error

Store stores results in the Git repo & updates the index.

func (Storage) Type

func (Storage) Type() string

Type returns the storage driver package name

Jump to

Keyboard shortcuts

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