ghactions

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ghactions maps a Levelrail deploy outcome onto GitHub deployment statuses and check runs, for the GitHub Actions deploy action.

Index

Constants

View Source
const (
	OutcomeSucceeded = "succeeded"
	OutcomeFailed    = "failed"
	OutcomeTimeout   = "timeout"
	OutcomeAccepted  = "accepted"
)

Deploy outcomes the CLI hands to Finish.

Variables

View Source
var SkipMarkers = []string{"[skip ci]", "[ci skip]", "[skip deploy]", "[no deploy]"}

SkipMarkers are the commit message markers that stop a push from deploying.

Functions

func Workflow

func Workflow(o WorkflowOptions) string

Workflow renders a deploy-on-push workflow that authenticates with the job OIDC identity, waits for the rollout and rolls back to the previous image on failure.

Types

type GitHub

type GitHub interface {
	CreateDeployment(ctx context.Context, instanceURL, token, owner, repo, ref, environment, description string, production bool) (int64, error)
	CreateDeploymentStatus(ctx context.Context, instanceURL, token, owner, repo string, id int64, state githubapp.DeploymentState, environmentURL, logURL, description string) error
	CreateCheckRun(ctx context.Context, instanceURL, token, owner, repo string, spec githubapp.CheckRunSpec) (int64, error)
	UpdateCheckRun(ctx context.Context, instanceURL, token, owner, repo string, id int64, spec githubapp.CheckRunSpec) error
}

GitHub is the slice of the GitHub client the reporter needs.

type IDs

type IDs struct {
	DeploymentID int64
	CheckRunID   int64
}

IDs are the GitHub objects Start created, passed back to Finish.

type Outcome

type Outcome struct {
	DeploymentState githubapp.DeploymentState
	PostDeployment  bool
	CheckConclusion string
	Summary         string
}

Outcome is how an outcome string maps onto GitHub's vocabularies.

func MapOutcome

func MapOutcome(outcome string) (Outcome, error)

MapOutcome translates a deploy outcome into deployment and check states.

type Reporter

type Reporter struct {
	GH          GitHub
	InstanceURL string
	Token       string
	Owner       string
	Repo        string
}

Reporter posts deploy progress to one repository.

func (*Reporter) Finish

func (r *Reporter) Finish(ctx context.Context, t Target, ids IDs, outcome string) (Result, error)

Finish moves the objects Start created to their final state. Calls for objects that were never created are skipped.

func (*Reporter) Start

func (r *Reporter) Start(ctx context.Context, t Target) Result

Start opens the deployment and check run as in progress.

type Result

type Result struct {
	IDs      IDs
	Warnings []error
}

Result carries Warnings for report calls that failed. A failed report is never fatal: the deploy outcome is the source of truth.

type Target

type Target struct {
	App            string
	SHA            string
	Environment    string
	EnvironmentURL string
	LogURL         string
	Production     bool
	Deployments    bool
	Checks         bool
}

Target describes what is being deployed and which reports are on.

type WorkflowOptions

type WorkflowOptions struct {
	App         string
	APIURL      string
	Branch      string
	Environment string
	Paths       []string
	IgnorePaths []string
	ActionRef   string
}

WorkflowOptions describes the workflow to generate.

Jump to

Keyboard shortcuts

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