writers

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultWriter = dotenvWriter

	// A map of all writers available.
	FromName = map[string]Writer{
		dotenvWriter.Name():  dotenvWriter,
		ghaEnvWriter.Name():  ghaEnvWriter,
		ghaMaskWriter.Name(): ghaMaskWriter,
	}
)

Functions

This section is empty.

Types

type DotenvWriter

type DotenvWriter struct{}

Outputs the values in .env file format

func NewDotenvWriter

func NewDotenvWriter() *DotenvWriter

Create a new dotenv-format writer

func (*DotenvWriter) FormatEnvironmentValues

func (ew *DotenvWriter) FormatEnvironmentValues(values map[string]values.Value) (string, error)

func (*DotenvWriter) Name

func (*DotenvWriter) Name() string

type GHAEnvWriter added in v0.0.4

type GHAEnvWriter struct{}

Outputs values in a format that can be parsed by GHA's `GITHUB_ENV` file. This is _almost_ the same as dotenv files, but also handles multiline environment values. For details, see https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable

func NewGHAEnvWriter added in v0.0.4

func NewGHAEnvWriter() *GHAEnvWriter

Create a new GHA env writer

func (*GHAEnvWriter) FormatEnvironmentValues added in v0.0.4

func (ew *GHAEnvWriter) FormatEnvironmentValues(values map[string]values.Value) (string, error)

func (*GHAEnvWriter) Name added in v0.0.4

func (*GHAEnvWriter) Name() string

type GHAMaskWriter added in v0.0.3

type GHAMaskWriter struct{}

Outputs secret values prefixed with `::add-mask::`, one per line. Per GHA docs, this will prevent the values from being logged. For details, see https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#masking-a-value-in-a-log

func NewGHAMaskWriter added in v0.0.3

func NewGHAMaskWriter() *GHAMaskWriter

Create a new GHA mask writer

func (*GHAMaskWriter) FormatEnvironmentValues added in v0.0.3

func (ew *GHAMaskWriter) FormatEnvironmentValues(values map[string]values.Value) (string, error)

func (*GHAMaskWriter) Name added in v0.0.3

func (*GHAMaskWriter) Name() string

type Writer

type Writer interface {
	// Take in environment key/value pairs and format them.
	FormatEnvironmentValues(values map[string]values.Value) (string, error)
	// Human-readable name of the writer, usually the output format.
	Name() string
}

Writers take environment values and create a string (usually to be written to a file) of a given format.

Jump to

Keyboard shortcuts

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