github

package
v0.0.0-...-3973644 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Context = ParseActionEnv()

Context contains details on the workflow execution

View Source
var GitHub = NewClient()

Functions

func DownloadSelectedRepositoryFiles

func DownloadSelectedRepositoryFiles(c *http.Client, owner, repo, branch string, include Matcher) map[string]RepositoryFile

DownloadSelectedRepositoryFiles downloads files from a given repository and granch, given that their name matches regarding the `include` function

func NewClient

func NewClient() *github.Client

Types

type ActionContext

type ActionContext struct {
	Payload           WebhookPayload
	EventName         string
	SHA               string
	Ref               string
	Workflow          string
	Action            string
	Actor             string
	Issue             ActionIssue
	Repo              ActionRepo
	OutputFilePath    string
	StateFilePath     string
	ExportEnvFilePath string
}

ActionContext contains details on the workflow execution

func ParseActionEnv

func ParseActionEnv() ActionContext

ParseActionEnv parses the environemnt and extracts the ActionContext on demand. For example in tests

type ActionIssue

type ActionIssue struct {
	Owner  string
	Repo   string
	Number int
}

type ActionRepo

type ActionRepo struct {
	Owner string
	Repo  string
}

type Matcher

type Matcher func(path string) bool

func MatchesOneOf

func MatchesOneOf(patterns ...string) Matcher

MatchesOneOf returns a matcher returning whether the path matches one of the provided glob patterns

type RepositoryFile

type RepositoryFile struct {
	Path     string
	FileInfo os.FileInfo
	Data     []byte
}

type WebhookPayload

type WebhookPayload struct {
	*github.PushEvent
	*github.MilestoneEvent
	// TODO: make this work with a simple interface user must be able to access payload.Repository for example
	// *github.CheckRunEvent
	// *github.CheckSuiteEvent
	// *github.CommitCommentEvent
	// *github.CreateEvent
	// *github.DeleteEvent
	// *github.DeployKeyEvent
	// *github.DeploymentEvent
	// *github.DeploymentStatusEvent
	// *github.ForkEvent
	// *github.GollumEvent
	// *github.InstallationEvent
	// *github.InstallationRepositoriesEvent
	// *github.IssueEvent
	// *github.IssueCommentEvent
	// *github.IssuesEvent
	// *github.LabelEvent
	// *github.MarketplacePurchaseEvent
	// *github.MemberEvent
	// *github.MembershipEvent
	// *github.MetaEvent
	// *github.OrgBlockEvent
	// *github.OrganizationEvent
	// *github.PageBuildEvent
	// *github.PingEvent
	// *github.ProjectEvent
	// *github.ProjectColumnEvent
	// *github.ProjectCardEvent
	// *github.PublicEvent
	// *github.PullRequestReviewEvent
	// *github.PullRequestReviewCommentEvent
	// *github.ReleaseEvent
	// *github.RepositoryEvent
	// *github.RepositoryDispatchEvent
	// *github.StarEvent
	// *github.StatusEvent
	// *github.TeamEvent
	// *github.TeamAddEvent
	// *github.UserEvent
	// *github.WatchEvent
	Number       *int                 `json:"number"`
	Label        *github.Label        `json:"label"`
	Repository   *github.Repository   `json:"repository"`
	Issue        *github.Issue        `json:"issue"`
	PullRequest  *github.PullRequest  `json:"pull_request"`
	Sender       *github.Contributor  `json:"sender"`
	Action       string               `json:"action"`
	Installation *github.Installation `json:"installation"`
}

WebhookPayload webhook payload object that triggered the workflow

Jump to

Keyboard shortcuts

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