ghactions

package module
v1.1.0-f Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

README

GHActions

GitHub tag (latest SemVer) Build Status godoc

Say Thanks!

Create a Github Action in 5 seconds!

Examples

package main

import (
	"context"
	"log"

	"github.com/google/go-github/v24/github"
	"github.com/ldez/ghactions"
	"github.com/ldez/ghactions/event"
)

func main() {
	ctx := context.Background()
	action := ghactions.NewAction(ctx)
	// action.SkipWhenNoHandler = true
	// action.SkipWhenTypeUnknown = true

	err := action.
		OnPullRequest(func(client *github.Client, requestEvent *github.PullRequestEvent) error {
			// TODO add your code.
			return nil
		}).
		OnIssues(func(client *github.Client, issuesEvent *github.IssuesEvent) error {
			// TODO add your code.
			return nil
		}).
		Run()

	if err != nil {
		log.Fatal(err)
	}
}

References

Documentation

Overview

Package ghactions Creates a GitHub Actions in 5s.

Index

Constants

View Source
const (
	GithubToken      = "GITHUB_TOKEN"
	Hostname         = "HOSTNAME"
	Home             = "HOME"
	GithubEventPath  = "GITHUB_EVENT_PATH"
	GithubWorkflow   = "GITHUB_WORKFLOW"
	Path             = "PATH"
	GithubAction     = "GITHUB_ACTION"
	GithubRepository = "GITHUB_REPOSITORY"
	GithubWorkspace  = "GITHUB_WORKSPACE"
	GithubSha        = "GITHUB_SHA"
	GithubActor      = "GITHUB_ACTOR"
	GithubRef        = "GITHUB_REF"
	PWD              = "PWD"
	GithubEventName  = "GITHUB_EVENT_NAME"
)

GitHub Action environment variables.

Variables

This section is empty.

Functions

func GetRepoInfo

func GetRepoInfo() (owner string, repoName string)

GetRepoInfo Split "GITHUB_REPOSITORY" to [owner, repoName].

Types

type Action

type Action struct {
	SkipWhenNoHandler   bool
	SkipWhenTypeUnknown bool
	// contains filtered or unexported fields
}

Action GitHub Action executor.

func NewAction

func NewAction(ctx context.Context) *Action

NewAction Creates a new GitHub Action executor.

func (*Action) OnCommitComment

func (a *Action) OnCommitComment(eventHandler func(*github.Client, *github.CommitCommentEvent) error) *Action

OnCommitComment CommitComment handler.

func (*Action) OnCreate

func (a *Action) OnCreate(eventHandler func(*github.Client, *github.CreateEvent) error) *Action

OnCreate Create handler.

func (*Action) OnDelete

func (a *Action) OnDelete(eventHandler func(*github.Client, *github.DeleteEvent) error) *Action

OnDelete Delete handler.

func (*Action) OnDeployment

func (a *Action) OnDeployment(eventHandler func(*github.Client, *github.DeploymentEvent) error) *Action

OnDeployment Deployment handler.

func (*Action) OnDeploymentStatus

func (a *Action) OnDeploymentStatus(eventHandler func(*github.Client, *github.DeploymentStatusEvent) error) *Action

OnDeploymentStatus DeploymentStatus handler.

func (*Action) OnFork

func (a *Action) OnFork(eventHandler func(*github.Client, *github.ForkEvent) error) *Action

OnFork Fork handler.

func (*Action) OnGollum

func (a *Action) OnGollum(eventHandler func(*github.Client, *github.GollumEvent) error) *Action

OnGollum Gollum handler.

func (*Action) OnIssueComment

func (a *Action) OnIssueComment(eventHandler func(*github.Client, *github.IssueCommentEvent) error) *Action

OnIssueComment IssueComment handler.

func (*Action) OnIssues

func (a *Action) OnIssues(eventHandler func(*github.Client, *github.IssuesEvent) error) *Action

OnIssues Issues handler.

func (*Action) OnLabel

func (a *Action) OnLabel(eventHandler func(*github.Client, *github.LabelEvent) error) *Action

OnLabel Label handler.

func (*Action) OnMember

func (a *Action) OnMember(eventHandler func(*github.Client, *github.MemberEvent) error) *Action

OnMember Member handler.

func (*Action) OnMilestone

func (a *Action) OnMilestone(eventHandler func(*github.Client, *github.MilestoneEvent) error) *Action

OnMilestone Milestone handler.

func (*Action) OnPageBuild

func (a *Action) OnPageBuild(eventHandler func(*github.Client, *github.PageBuildEvent) error) *Action

OnPageBuild PageBuild handler.

func (*Action) OnProject

func (a *Action) OnProject(eventHandler func(*github.Client, *github.ProjectEvent) error) *Action

OnProject Project handler.

func (*Action) OnProjectCard

func (a *Action) OnProjectCard(eventHandler func(*github.Client, *github.ProjectCardEvent) error) *Action

OnProjectCard ProjectCard handler.

func (*Action) OnProjectColumn

func (a *Action) OnProjectColumn(eventHandler func(*github.Client, *github.ProjectColumnEvent) error) *Action

OnProjectColumn ProjectColumn handler.

func (*Action) OnPublic

func (a *Action) OnPublic(eventHandler func(*github.Client, *github.PublicEvent) error) *Action

OnPublic Public handler.

func (*Action) OnPullRequest

func (a *Action) OnPullRequest(eventHandler func(*github.Client, *github.PullRequestEvent) error) *Action

OnPullRequest PullRequest handler.

func (*Action) OnPullRequestReview

func (a *Action) OnPullRequestReview(eventHandler func(*github.Client, *github.PullRequestReviewEvent) error) *Action

OnPullRequestReview PullRequestReview handler.

func (*Action) OnPullRequestReviewComment

func (a *Action) OnPullRequestReviewComment(eventHandler func(*github.Client, *github.PullRequestReviewCommentEvent) error) *Action

OnPullRequestReviewComment PullRequestReviewComment handler.

func (*Action) OnPush

func (a *Action) OnPush(eventHandler func(*github.Client, *github.PushEvent) error) *Action

OnPush Push handler.

func (*Action) OnRelease

func (a *Action) OnRelease(eventHandler func(*github.Client, *github.ReleaseEvent) error) *Action

OnRelease Release handler.

func (*Action) OnRepositoryVulnerabilityAlert

func (a *Action) OnRepositoryVulnerabilityAlert(eventHandler func(*github.Client, *github.RepositoryVulnerabilityAlertEvent) error) *Action

OnRepositoryVulnerabilityAlert RepositoryVulnerabilityAlert handler.

func (*Action) OnStatus

func (a *Action) OnStatus(eventHandler func(*github.Client, *github.StatusEvent) error) *Action

OnStatus Status handler.

func (*Action) OnWatch

func (a *Action) OnWatch(eventHandler func(*github.Client, *github.WatchEvent) error) *Action

OnWatch Watch handler.

func (*Action) Run

func (a *Action) Run() error

Run Executes action.

Directories

Path Synopsis
Package event Event types.
Package event Event types.

Jump to

Keyboard shortcuts

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