github

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0, MIT Imports: 18 Imported by: 0

Documentation

Overview

Package github integrates Skiff with a GitHub App: it drives the app-manifest creation flow, mints installation access tokens, lists installed repos, builds authenticated clone URLs, and verifies incoming webhooks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifest

func Manifest(baseURL, name string) string

Manifest is the GitHub App manifest posted to github.com/settings/apps/new.

func VerifySignature

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

VerifySignature checks the X-Hub-Signature-256 header against the webhook secret.

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: its identity, private key, secrets, and the installation it's bound to. Stored 0600 at ~/.skiff/github.json.

func ConvertManifest

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

ConvertManifest exchanges the temporary manifest code for the app credentials.

func Load

func Load() *Config

func (*Config) CloneURLWithToken

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

CloneURLWithToken returns an authenticated https clone URL for private repos.

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)

ListRepos returns every repository the installation can access.

func (*Config) Save

func (c *Config) Save() error

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)

ParsePush extracts the repo, branch, head commit, and changed paths from a push event.

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