github

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 13 Imported by: 1 module, 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 github reads repo settings: branch protection and rulesets merged into effective rules, environments, plan limits and repo tarballs.

Index

Constants

View Source
const ExportFile = "evidence/rulesets.json"

ExportFile is where a repo admin's ruleset export lives.

View Source
const ExportMaxAge = 30 * 24 * time.Hour

ExportMaxAge is how long CI may rely on an export.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector struct{ connector.Base }

Connector reads GitHub.

func New

func New() *Connector

New returns the connector.

func (*Connector) Available

func (c *Connector) Available(s connector.Scope) (bool, string)

Available is true when a token is present and repos are listed.

func (*Connector) Collect

Collect reads settings for every listed repo.

func (*Connector) Collections

func (c *Connector) Collections() []connector.Collection

Collections lists what it reads.

func (*Connector) ExportRulesets

func (c *Connector) ExportRulesets(ctx context.Context, s connector.Scope) (string, int, error)

ExportRulesets reads every listed repo's rulesets as the current user, who must be a repo admin for the bypass lists to be returned, and writes the export.

func (*Connector) RepoIsPublic

func (c *Connector) RepoIsPublic(ctx context.Context, s connector.Scope, owner, repo string) (public, known bool)

RepoIsPublic reads a repo's visibility through the GitHub connection, for the check that keeps records out of public repos on a laptop.

func (*Connector) Tarball

func (c *Connector) Tarball(s connector.Scope) func(ctx context.Context, repo string) (io.ReadCloser, error)

Tarball returns a function that downloads a repo's committed files.

type Export

type Export struct {
	GeneratedAt time.Time                           `json:"generated_at"`
	GeneratedBy string                              `json:"generated_by"`
	Repos       map[string]map[string]RulesetExport `json:"repos"`
}

Export is the file a repo admin commits so CI can see bypass lists.

type RulesetExport

type RulesetExport struct {
	Name         string            `json:"name"`
	BypassActors []json.RawMessage `json:"bypass_actors"`
}

RulesetExport is one ruleset in an export.

Jump to

Keyboard shortcuts

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