github

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: MIT Imports: 13 Imported by: ? 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

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"`
	// 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