github

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: Apache-2.0 Imports: 20 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

Overview

Package github implements GitHub Actions gate to allow Webhooks to trigger Applications events

Index

Constants

View Source
const DefaultUpdateHooksInterval = time.Hour

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Webhook Push config
	BindAddress string `json:"bind_address"` // Where to listen for incoming requests

	// Webhook Pull config
	APIToken string `json:"api_token"` // GitHub API personal fine-grained token

	APIAppID        int64  `json:"api_app_id"`         // GitHub App ID
	APIAppInstallID int64  `json:"api_app_install_id"` // GitHub App Installation ID
	APIAppKey       string `json:"api_app_key"`        // GitHub App private key in pem format

	APIPerPage int `json:"api_per_page"` // In case you want to save rate limit on lists, default: 100

	// Interval between hooks updates (set to -1 if don't want it to run periodically), default: 1h
	APIUpdateHooksInterval util.Duration `json:"api_update_hooks_interval"`
	// Interval between cleanups of runners (set to -1 if don't want to run it periodically), default: 1h
	APICleanupRunnersInterval util.Duration `json:"api_cleanup_runners_interval"`
	// Minimal interval in between deliveries checks, default: 30s
	APIMinCheckInterval util.Duration `json:"api_min_check_interval"`

	// Common configs
	// Filter contains pattern of the repos full name "org/repo" (accepts path.Match patterns)
	// and configuration. You have to set at least one filter ('*/*' for example)
	Filters map[string]Filter `json:"filters"`

	DeliveryValidInterval util.Duration `json:"delivery_valid_interval"`  // For how long to see the delivery as valid since it's delivery time, default: 30m
	DefaultJobMaxLifetime util.Duration `json:"default_job_max_lifetime"` // Used when job is stuck not completed and no lifetime is set for the label, default: 12h

	// If you need to use this gate with GitHub enterprise installation - set those configs
	EnterpriseBaseURL   string `json:"enterprise_base_url"`   // Format: http(s)://[hostname]/api/v3/
	EnterpriseUploadURL string `json:"enterprise_upload_url"` // Format: http(s)://[hostname]/api/uploads/

}

Config - node driver configuration

func (*Config) Apply

func (c *Config) Apply(config []byte) error

Apply takes json and applies it to the config structure

func (*Config) Validate

func (c *Config) Validate() (err error)

Validate makes sure the config have the required defaults & that the required fields are set

type Driver

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

Driver implements drivers.ResourceDriver interface

func (*Driver) GetRPCServices added in v0.9.0

func (*Driver) GetRPCServices() []gate.RPCService

GetRPCServices returns RPC services this gate driver wants to register GitHub gate doesn't expose any RPC services

func (*Driver) Name

func (d *Driver) Name() string

Name returns name of the gate

func (*Driver) Prepare

func (d *Driver) Prepare(_ string, config []byte) error

Prepare initializes the driver

func (*Driver) SetName

func (d *Driver) SetName(name string)

SetName allows to receive the actual name of the driver

func (*Driver) Shutdown

func (d *Driver) Shutdown() error

Shutdown gracefully stops the gate

type Factory

type Factory struct{}

Factory implements gate.DriverFactory interface

func (*Factory) Name

func (*Factory) Name() string

Name shows name of the gate factory

func (*Factory) New

func (f *Factory) New(db *database.Database) gate.Driver

New creates new gate driver

type Filter

type Filter struct {
	// Acceptable secret of webhook requests, if not set - incoming requests will be skipped
	WebhookSecret string `json:"webhook_secret"`
}

Jump to

Keyboard shortcuts

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