model

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ActionRunsUsingNode12 for running with node12
	ActionRunsUsingNode12 = "node12"
	// ActionRunsUsingNode12 for running with node16
	ActionRunsUsingNode16 = "node16"
	// ActionRunsUsingDocker for running with docker
	ActionRunsUsingDocker = "docker"
	// ActionRunsUsingComposite for running composite
	ActionRunsUsingComposite = "composite"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Name        string            `yaml:"name"`
	Author      string            `yaml:"author"`
	Description string            `yaml:"description"`
	Inputs      map[string]Input  `yaml:"inputs"`
	Outputs     map[string]Output `yaml:"outputs"`
	Runs        ActionRuns        `yaml:"runs"`
	Branding    struct {
		Color string `yaml:"color"`
		Icon  string `yaml:"icon"`
	} `yaml:"branding"`
}

Action describes a metadata file for GitHub actions. The metadata filename must be either action.yml or action.yaml. The data in the metadata file defines the inputs, outputs and main entrypoint for your action.

func ReadAction

func ReadAction(in io.Reader) (*Action, error)

ReadAction reads an action from a reader

type ActionRuns

type ActionRuns struct {
	Using      ActionRunsUsing   `yaml:"using"`
	Env        map[string]string `yaml:"env"`
	Main       string            `yaml:"main"` // index.js path
	Pre        string            `yaml:"pre"`
	PreIf      string            `yaml:"pre-if"`
	Post       string            `yaml:"post"`
	PostIf     string            `yaml:"post-if"`
	Image      string            `yaml:"image"`
	Entrypoint string            `yaml:"entrypoint"`
	Args       []string          `yaml:"args"`
	Steps      []Step            `yaml:"steps"`
}

ActionRuns are a field in Action

type ActionRunsUsing

type ActionRunsUsing string

ActionRunsUsing is the type of runner for the action

func (*ActionRunsUsing) UnmarshalYAML

func (a *ActionRunsUsing) UnmarshalYAML(unmarshal func(interface{}) error) error

type Input

type Input struct {
	Description string `yaml:"description"`
	Required    bool   `yaml:"required"`
	Default     string `yaml:"default"`
}

Input parameters allow you to specify data that the action expects to use during runtime. GitHub stores input parameters as environment variables. Input ids with uppercase letters are converted to lowercase during runtime. We recommended using lowercase input ids.

type Output

type Output struct {
	Description string `yaml:"description"`
	Value       string `yaml:"value"`
}

Output parameters allow you to declare data that an action sets. Actions that run later in a workflow can use the output data set in previously run actions. For example, if you had an action that performed the addition of two inputs (x + y = z), the action could output the sum (z) for other actions to use as an input.

type Step

type Step struct {
	ID                 string            `yaml:"id"`
	If                 bool              `yaml:"if"`
	Name               string            `yaml:"name"`
	Uses               string            `yaml:"uses"`
	Run                string            `yaml:"run"`
	WorkingDirectory   string            `yaml:"working-directory"`
	Shell              string            `yaml:"shell"`
	Env                map[string]string `yaml:"env"`
	With               map[string]string `yaml:"with"`
	RawContinueOnError string            `yaml:"continue-on-error"`
	TimeoutMinutes     string            `yaml:"timeout-minutes"`
}

Step is the structure of one step in a job

func NewStep

func NewStep(uses string, with map[string]string) Step

func (*Step) Environment

func (s *Step) Environment() map[string]string

Environments returns string-based key=value map for a step Note: all keys are uppercase

func (*Step) GetEnv

func (s *Step) GetEnv() map[string]string

GetEnv gets the env for a step getenv from input

func (*Step) String

func (s *Step) String() string

String gets the name of step

func (*Step) Type

func (s *Step) Type() StepType

Type returns the type of the step

type StepType

type StepType int

StepType describes what type of step we are about to run

const (
	// StepTypeRun is all steps that have a `run` attribute run with docker exec
	StepTypeRun StepType = iota

	// StepTypeUsesDockerURL is all steps that have a `uses` that is of the form `docker://...`
	StepTypeUsesDockerURL

	// StepTypeUsesActionLocal is all steps that have a `uses` that is a local action in a subdirectory
	StepTypeUsesActionLocal

	// StepTypeUsesActionRemote is all steps that have a `uses` that is a reference to a github repo  run with node index.js
	StepTypeUsesActionRemote

	// StepTypeReusableWorkflowLocal is all steps that have a `uses` that is a local workflow in the .github/workflows directory
	StepTypeReusableWorkflowLocal

	// StepTypeReusableWorkflowRemote is all steps that have a `uses` that references a workflow file in a github repo
	StepTypeReusableWorkflowRemote

	// StepTypeInvalid is for steps that have invalid step action
	StepTypeInvalid
)

func (StepType) String

func (s StepType) String() string

Jump to

Keyboard shortcuts

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