github

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0, MIT Imports: 21 Imported by: 0 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

Overview

Package github integrates Skiff with a GitHub App: manifest creation, installation tokens, repo listing, authenticated clone URLs, and webhook verification.

Index

Constants

This section is empty.

Variables

View Source
var ErrForbidden = errors.New("github app lacks permission")

ErrForbidden means the app isn't allowed to do this, usually a permission it was never granted.

Functions

func Manifest

func Manifest(baseURL, name string) string

func VerifySignature

func VerifySignature(secret string, body []byte, sig string) bool

Types

type Config

type Config struct {
	ID             int64  `json:"id"`
	Slug           string `json:"slug"`
	PEM            string `json:"pem"`
	WebhookSecret  string `json:"webhook_secret"`
	ClientID       string `json:"client_id"`
	ClientSecret   string `json:"client_secret"`
	InstallationID int64  `json:"installation_id"`
}

Config is the persisted GitHub App (identity, private key, secrets, installation); stored 0600 at ~/.skiff/github.json.

func ConvertManifest

func ConvertManifest(code string) (*Config, error)

func Load

func Load() *Config

func (*Config) CloneURLWithToken

func (c *Config) CloneURLWithToken(cloneURL string) (string, error)

func (*Config) Configured

func (c *Config) Configured() bool

func (*Config) InstallURL

func (c *Config) InstallURL() string

func (*Config) InstallationToken

func (c *Config) InstallationToken() (string, error)

InstallationToken returns a cached installation access token (1h TTL).

func (*Config) Installed

func (c *Config) Installed() bool

func (*Config) ListRepos

func (c *Config) ListRepos() ([]Repo, error)

func (*Config) OpenPullRequest added in v0.2.0

func (c *Config) OpenPullRequest(repo, branch string) (int, error)

OpenPullRequest finds the open pull request whose head is branch in repo ("owner/name"); 0 when there is none.

func (*Config) Save

func (c *Config) Save() error

func (*Config) UpsertComment added in v0.2.0

func (c *Config) UpsertComment(repo string, pr int, commentID int64, body string) (int64, error)

UpsertComment edits the comment if it still exists, otherwise posts a new one, returning the comment's id.

type Push

type Push struct {
	Repo    string // owner/name
	Branch  string
	Commit  string
	Message string   // head commit message (first line shown in the UI)
	Paths   []string // changed files (best-effort; GitHub truncates very large pushes)
}

func ParsePush

func ParsePush(body []byte) (Push, bool)

type Repo

type Repo struct {
	FullName      string `json:"full_name"`
	Name          string `json:"name"`
	Private       bool   `json:"private"`
	DefaultBranch string `json:"default_branch"`
	CloneURL      string `json:"clone_url"`
}

Jump to

Keyboard shortcuts

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