actionsexpr

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package actionsexpr evaluates GitHub Actions workflow expressions for tests that must ask what GitHub would DO with a committed workflow, not merely whether a string is present in it. A substring assertion passes a predicate that has been rewritten to mean something else; evaluating it cannot.

It is test support, imported only by _test.go files, on the internal/gittest and internal/testsecret precedent: the workflow contracts live in more than one package (core/lint holds the repository's own workflows, and core/launch/scaffold the templates a managed repository is scaffolded from), and an evaluator spelled twice is one the two can disagree about.

It implements the slice of the expression language the workflows here use, and it fails CLOSED on the rest: an unknown context path or an unsupported function is an error the caller reports as a failure, never a guessed value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalIf

func EvalIf(raw string, ctx map[string]any) (bool, error)

EvalIf evaluates a job's or a step's `if:` condition the way GitHub decides whether to run it. The value may be written bare or as one `${{ }}` expression. A condition that names no status-check function is evaluated as `success() && (<condition>)`, GitHub's implicit default, which is what skips a job whose need failed or was skipped however its own condition reads; the context therefore states success() whenever it is asked about such a condition.

func EvalValue

func EvalValue(raw string, ctx map[string]any) (any, error)

EvalValue evaluates one YAML value the way GitHub would, in the given expression context: a bare `true`/`false`, a value that is exactly one `${{ }}` expression (which keeps its own type), or a string with expressions interpolated into it.

func Stringify

func Stringify(v any) string

Stringify renders a value the way GitHub interpolates it into a string.

func Truthy

func Truthy(v any) bool

Truthy applies GitHub's falsy set: false, 0, the empty string, and null.

Types

This section is empty.

Jump to

Keyboard shortcuts

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