ghfilter

package module
v0.0.0-...-0b98a36 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2017 License: BSD-2-Clause Imports: 5 Imported by: 1

README

Introduction Build Status GoDoc

ghfilter provides primitives for filtering GitHub events.

Depends on go-github.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition struct {
	// Negate causes a positive match to return false, instead of true.
	//
	// If a condition requires fields to be set, they will continue to return false.
	// For example, if Nagate is true and PayloadAction a non zero value, if the
	// event does not have a payload with an action key, the match will continue
	// to be false.
	Negate bool
	// Type compares the Event's Type field. An empty Type will skip the check.
	Type string
	// PayloadAction compares the event's Action field in its payload. If not empty
	// the event must have a non-nil payload, must have an string action field. An
	// empty PayloadAction will skip the check. Comparison is case insensitive.
	PayloadAction string
	// PayloadIssueLabel compares the event's issue labels array. If not empty
	// the payload must have a non-nil payload, issue and labels field. If empty the
	// fields are not checked. Comparison is case insensitive.
	PayloadIssueLabel string
	// PayloadIssueMilestoneTitle compares the event's issue milestone's title. If not
	// empty the payload must have a non-nil payload, issue and milestone field. If
	// empty the fields are not checked. Comparison is case insensitive.
	PayloadIssueMilestoneTitle string
	// PayloadIssueTitleRegexp compares the event's issue title against regexp. If not
	// empty the payload must have a non-nil payload, issue and title field. If
	// empty the fields are not checked. See https://golang.org/pkg/regexp for syntax.
	PayloadIssueTitleRegexp string
	// PayloadIssueBodyRegexp compares the event's issue body against regexp. If not
	// empty the payload must have a non-nil payload, issue and body field. If
	// empty the fields are not checked. See https://golang.org/pkg/regexp for syntax.
	PayloadIssueBodyRegexp string
	// ComparePublic enables comparing of the event's public field with the condition's
	// Public value. Setting to false will skip checking the Public field.
	ComparePublic bool
	// Public compares the event's Public field. ComparePublic must be set to true to
	// compare the Public field.
	Public bool
	// OrganizationID compares the event's Organizaton's ID field. The event must have
	// a non-nil Organization. A zero value will skip the check.
	OrganizationID int
	// RepositoryID compares the event's Repository's ID field. The event must have
	// a non-nil Repository. A zero value will skip the check.
	RepositoryID int
}

A Condition is a test which compares multiple fields with a GitHub event's.

func (*Condition) Matches

func (c *Condition) Matches(event *github.Event) bool

Matches returns false if any test fails. In other words, it returns true if all tests pass or no tests are set. TODO rename to Test?

func (Condition) String

func (c Condition) String() string

type Filter

type Filter struct {
	Conditions []Condition
}

Filter is a collection of conditions.

func (*Filter) Matches

func (f *Filter) Matches(event *github.Event) bool

Matches returns true if event matches all conditions, else return false.

Jump to

Keyboard shortcuts

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