Help us shape the future of Go! Take the 2026 Go Developer Survey

githubapp

package
v0.2.39 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnavailable = errors.New("GitHub App setup unavailable")
)
View Source
var ErrWebhookUnavailable = fmt.Errorf("%w: GitHub App webhook endpoint is unavailable", ErrUnavailable)
View Source
var Events = []string{"push", "pull_request", "repository", "check_run", "check_suite", "status", "workflow_run"}
View Source
var Permissions = map[string]string{
	"metadata":             "read",
	"contents":             "write",
	"pull_requests":        "write",
	"checks":               "write",
	"statuses":             "read",
	"actions":              "write",
	"workflows":            "write",
	"administration":       "read",
	"members":              "read",
	"issues":               "read",
	"vulnerability_alerts": "read",
}

Functions

This section is empty.

Types

type Created

type Created struct {
	ID         string `json:"id"`
	HandoffURL string `json:"handoff_url"`
}

type Handoff

type Handoff struct {
	OrgID    string
	Action   string
	Manifest string
	Location string
}

type Hosted

type Hosted struct {
	AppID         int64
	Slug          string
	ClientID      string
	ClientSecret  []byte `json:"-"`
	PrivateKeyPEM []byte `json:"-"`
	WebhookSecret []byte `json:"-"`
	// contains filtered or unexported fields
}

func LoadHosted

func LoadHosted(f config.GitHubAppFiles) (*Hosted, error)

func (Hosted) GoString

func (h Hosted) GoString() string

func (Hosted) LogValue

func (h Hosted) LogValue() slog.Value

func (Hosted) String

func (h Hosted) String() string

type Options

type Options struct {
	PublicURL   string
	Edition     string
	Development bool
	Hosted      *Hosted
	Web, API    string
	Transport   http.RoundTripper
}

type Pending

type Pending struct {
	ID        string    `json:"id"`
	Phase     string    `json:"phase"`
	AppSlug   string    `json:"app_slug,omitempty"`
	ExpiresAt time.Time `json:"expires_at"`
	ResumeURL string    `json:"resume_url,omitempty"`
}

type Result

type Result struct {
	OrgID        string
	Outcome      string
	Reason       string
	ConnectionID string
	Location     string
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(db *store.Store, identity *auth.Service, vault *secrets.Vault, conns *connections.Service, inv *inventory.Service, opt Options) *Service

func (*Service) Cancel

func (s *Service) Cancel(ctx context.Context, session auth.Session, org, id, request string) error

func (*Service) Cleanup

func (s *Service) Cleanup(ctx context.Context) error

func (*Service) HandleWebhook

func (s *Service) HandleWebhook(ctx context.Context, headers http.Header, body []byte) error

func (*Service) Handoff

func (s *Service) Handoff(ctx context.Context, session auth.Session, id string) (Handoff, error)

func (*Service) InstallCallback

func (s *Service) InstallCallback(ctx context.Context, session auth.Session, installation, action, state string) Result

func (*Service) ManifestCallback

func (s *Service) ManifestCallback(ctx context.Context, session auth.Session, code, state string) Result

func (*Service) OAuthCallback

func (s *Service) OAuthCallback(ctx context.Context, session auth.Session, code, state, providerError string) Result

func (*Service) Run

func (s *Service) Run(ctx context.Context)

func (*Service) Start

func (s *Service) Start(ctx context.Context, session auth.Session, org, name, githubOrg, request string) (Created, error)

func (*Service) Status

func (s *Service) Status(ctx context.Context, session auth.Session, org string) (Status, error)

func (*Service) WebOrigin

func (s *Service) WebOrigin() string

type Status

type Status struct {
	Mode    string   `json:"mode"`
	Reason  string   `json:"reason,omitempty"`
	Pending *Pending `json:"pending,omitempty"`
}

Jump to

Keyboard shortcuts

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