ghaoutput

package
v0.16.1-rc.0 Latest Latest
Warning

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

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

Documentation

Overview

Package ghaoutput writes step outputs to the file named by $GITHUB_OUTPUT, using plain key=value lines for single-line values and randomized heredoc delimiters for multiline values so untrusted content cannot forge additional outputs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatLine added in v0.16.1

func FormatLine(key, value string) string

FormatLine renders one $GITHUB_OUTPUT entry. Single-line values use the plain key=value form. Values containing a newline use GitHub's documented heredoc form with a random per-value delimiter: output values can carry arbitrary text (commit messages reach changelog outputs), and with a fixed or key-derived delimiter a value containing that delimiter as a bare line terminates the block early, so the remaining lines parse as forged outputs.

Types

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer handles writing outputs to GitHub Actions $GITHUB_OUTPUT file

func New

func New() *Writer

New creates a new Writer instance

func (*Writer) Flush

func (w *Writer) Flush() (err error)

Flush writes all outputs to $GITHUB_OUTPUT or stdout. The error return is named so the deferred Close can surface a failure to persist the buffered content; with an unnamed return the deferred assignment would mutate a local after the return value was already copied, silently dropping the flush-to-disk error.

func (*Writer) Set

func (w *Writer) Set(key, value string)

Set sets a simple key-value output

func (*Writer) SetBool

func (w *Writer) SetBool(key string, value bool)

SetBool sets a boolean output as a string

func (*Writer) SetJSON

func (w *Writer) SetJSON(key string, value any) error

SetJSON marshals a value to JSON and sets it as output

func (*Writer) SetMultiline

func (w *Writer) SetMultiline(key, value string)

SetMultiline sets a multiline output value

Jump to

Keyboard shortcuts

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