atlasaction

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatePending  = "PENDING_USER"
	StateApproved = "APPROVED"
	StateAborted  = "ABORTED"
	StateApplied  = "APPLIED"
)
View Source
const EOF = "\n"

Line separator for logging.

Variables

View Source
var Version string

Version holds atlas-action version. When built with cloud packages should be set by build flag, e.g. "-X 'ariga.io/atlas-action/atlasaction.Version=v0.1.2'"

Functions

func MigrateApply

func MigrateApply(ctx context.Context, client *atlasexec.Client, act Action) error

MigrateApply runs the GitHub Action for "ariga/atlas-action/migrate/apply".

func MigrateDown added in v1.0.11

func MigrateDown(ctx context.Context, client *atlasexec.Client, act Action) (err error)

MigrateDown runs the GitHub Action for "ariga/atlas-action/migrate/down".

func MigrateLint

func MigrateLint(ctx context.Context, client *atlasexec.Client, act Action) error

MigrateLint runs the GitHub Action for "ariga/atlas-action/migrate/lint"

func MigratePush

func MigratePush(ctx context.Context, client *atlasexec.Client, act Action) error

MigratePush runs the GitHub Action for "ariga/atlas-action/migrate/push"

func MigrateTest added in v1.1.3

func MigrateTest(ctx context.Context, client *atlasexec.Client, act Action) error

MigrateTest runs the GitHub Action for "ariga/atlas-action/migrate/test"

func SchemaTest added in v1.1.4

func SchemaTest(ctx context.Context, client *atlasexec.Client, act Action) error

SchemaTest runs the GitHub Action for "ariga/atlas-action/schema/test"

Types

type Action added in v1.1.0

type Action interface {
	Logger
	// GetType returns the type of atlasexec trigger Type. e.g. "GITHUB_ACTION"
	// The value is used to identify the type on CI-Run page in Atlas Cloud.
	GetType() atlasexec.TriggerType
	// GetInput returns the value of the input with the given name.
	GetInput(string) string
	// SetOutput sets the value of the output with the given name.
	SetOutput(string, string)
	// TriggerContext returns the context of the trigger event.
	GetTriggerContext() (*TriggerContext, error)
	// AddStepSummary adds a summary to the action step.
	AddStepSummary(string)
}

Atlas action interface.

func NewCircleCIOrb added in v1.1.0

func NewCircleCIOrb() Action

New returns a new Action for GitHub Actions.

func NewGHAction added in v1.1.0

func NewGHAction(otps ...githubactions.Option) Action

New returns a new Action for GitHub Actions.

type Actor added in v1.0.10

type Actor struct {
	Name string `env:"GITHUB_ACTOR"`
	ID   string `env:"GITHUB_ACTOR_ID"`
}

Actor Information about the actor that triggered the action.

type Logger added in v1.1.0

type Logger interface {
	// Infof logs an info message.
	Infof(string, ...interface{})
	// Warningf logs a warning message.
	Warningf(string, ...interface{})
	// Errorf logs an error message.
	Errorf(string, ...interface{})
	// Fatalf logs a fatal error message and exits the action.
	Fatalf(string, ...interface{})
	// WithFieldsMap returns a new Logger with the given fields.
	WithFieldsMap(map[string]string) Logger
}

type Provider added in v1.1.0

type Provider string
const (
	ProviderGithub Provider = "GITHUB"
)

SCM Provider constants.

type PullRequest added in v1.1.0

type PullRequest struct {
	// Pull Request Number
	Number int
	// URL of the pull request. e.g "https://github.com/ariga/atlas-action/pull/1"
	URL string
	// Lastest commit SHA.
	Commit string
}

PullRequest holds the pull request information.

type SCM added in v1.1.0

type SCM struct {
	// Type of the SCM, e.g. "GITHUB" / "GITLAB" / "BITBUCKET".
	Provider Provider
	// APIURL is the base URL for the SCM API.
	APIURL string
}

SCM holds the source control management system information.

type TriggerContext added in v1.1.0

type TriggerContext struct {
	// SCM is the source control management system.
	SCM SCM
	// Repo is the repository name. e.g. "ariga/atlas-action".
	Repo string
	// RepoURL is full URL of the repository. e.g. "https://github.com/ariga/atlas-action".
	RepoURL string
	// Branch name.
	Branch string
	// Commit SHA.
	Commit string
	// PullRequest will be available if the event is "pull_request".
	PullRequest *PullRequest
}

Context holds the context of the environment the action is running in.

Jump to

Keyboard shortcuts

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