handler

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: LGPL-3.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPullRequests

func GetPullRequests(ctx context.Context, client *github.Client, owner string, repo string, opts *github.ListOptions) ([]*github.PullRequest, error)

func Log

func Log(format string, a ...interface{})

func PaginatedRequest

func PaginatedRequest(
	initFn func() interface{},
	reqFn func(interface{}, int) (interface{}, *github.Response, error),
) (interface{}, error)

func ParseNumPages

func ParseNumPages(resp *github.Response) int

ParseNumPages Given a link header string representing pagination info, returns total number of pages.

func ParseNumPagesFromLink(link string) int

func ProcessEvent

func ProcessEvent(event *ActionEvent) []int

processEvent process the GitHub event and returns the list of pull requests that are affected by the event.

Types

type ActionEvent

type ActionEvent struct {
	ActionName       *string          `json:"action,omitempty"`
	ActionPath       *string          `json:"action_path,omitempty"`
	ActionRef        *string          `json:"action_ref,omitempty"`
	ActionRepository *string          `json:"action_repository,omitempty"`
	ActionStatus     *string          `json:"action_status,omitempty"`
	Actor            *string          `json:"actor,omitempty"`
	ApiUrl           *string          `json:"api_url,omitempty"`
	BaseRef          *string          `json:"base_ref,omitempty"`
	HeadRef          *string          `json:"head_ref,omitempty"`
	Env              *string          `json:"env,omitempty"`
	EventPayload     *json.RawMessage `json:"event,omitempty"`
	EventName        *string          `json:"event_name,omitempty"`
	EventPath        *string          `json:"event_path,omitempty"`
	QraphqlUrl       *string          `json:"graphql_url,omitempty"`
	JobID            *string          `json:"job,omitempty"`
	Ref              *string          `json:"ref,omitempty"`
	RefName          *string          `json:"ref_name,omitempty"`
	RefProtected     *bool            `json:"ref_protected,omitempty"`
	RefType          *string          `json:"ref_type,omitempty"`
	Path             *string          `json:"path,omitempty"`
	Repository       *string          `json:"repository,omitempty"`
	RepositoryOwner  *string          `json:"repository_owner,omitempty"`
	RepositoryUrl    *string          `json:"repositoryUrl,omitempty"`
	RetentionDays    *string          `json:"retention_days,omitempty"`
	RunID            *string          `json:"run_id,omitempty"`
	RunNumber        *string          `json:"run_number,omitempty"`
	RunAttempt       *string          `json:"run_attempt,omitempty"`
	ServerUrl        *string          `json:"server_url,omitempty"`
	SHA              *string          `json:"sha,omitempty"`
	Token            *string          `json:"token,omitempty"`
	Workflow         *string          `json:"workflow,omitempty"`
	Workspace        *string          `json:"workspace,omitempty"`
}

ActionEvent contains information about the workflow run and the event that triggered the run. For more information, visit: https://docs.github.com/en/actions/learn-github-actions/contexts#github-context

func ParseEvent

func ParseEvent(rawEvent string) (*ActionEvent, error)

ParseEvent parses GitHub raw event to ActionEvent

Jump to

Keyboard shortcuts

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