Initial commit with support for GitHub actions

This commit is contained in:
Casey Lee
2019-01-12 20:45:25 -08:00
parent d136b830f2
commit f683af5954
33 changed files with 2941 additions and 1 deletions

56
actions/types.go Normal file
View File

@@ -0,0 +1,56 @@
package actions
import (
"context"
)
// Workflows provides capabilities to work with the workflow file
type Workflows interface {
EventGrapher
EventLister
ActionRunner
EventRunner
Close()
}
// EventGrapher to list the actions
type EventGrapher interface {
GraphEvent(eventName string) ([][]string, error)
}
// EventLister to list the events
type EventLister interface {
ListEvents() []string
}
// ActionRunner to run an action
type ActionRunner interface {
RunAction(ctx context.Context, dryrun bool, action string) error
}
// EventRunner to run an event
type EventRunner interface {
RunEvent(ctx context.Context, dryrun bool, event string) error
}
type workflowDef struct {
On string
Resolves []string
}
type actionDef struct {
Needs []string
Uses string
Runs string
Args []string
Env map[string]string
Secrets []string
}
type workflowsFile struct {
TempDir string
WorkingDir string
WorkflowPath string
Workflow map[string]workflowDef
Action map[string]actionDef
}