A toolkit for writing GitHub Actions in Go, patterned after the JavaScript actions/toolkit. The API is Go-shaped rather than a line-for-line port. Requires Go 1.27 or later.
go get github.com/asteroid-computing/actions-toolkit-goThe API is not yet stable: while the version is below 1.0.0, a minor release may contain breaking changes, which CHANGELOG.md calls out.
core— inputs (GetInput,GetBooleanInput,GetMultilineInput), outputs and file commands (SetOutput,SetOutputJSON,SetEnv,SetState/GetState,AddToPath), logging and workflow commands (Info,Debug,Notice,Warning,Error,Group,StartGroup/EndGroup,MaskValue,StopCommands,SetCommandEcho,IsDebug), path separator conversion (ToPosixPath,ToWin32Path,ToPlatformPath), failing the step (SetFailed), GitHub OIDC ID tokens for keyless cloud authentication (GetIDToken) and the job summary builder (StepSummary).actioncontext— the run's context, read byactioncontext.Load()from the default environment variables, with the event payload decoded into the matching go-github type (PullRequestEvent(),PushEvent(), …), the raw payload (RawEventPayload()), andNewGitHubClienttargeting the run's API host (github.com or GHES).
package main
import (
"fmt"
"os"
"github.com/asteroid-computing/actions-toolkit-go/actioncontext"
"github.com/asteroid-computing/actions-toolkit-go/core"
)
func main() {
name, err := core.GetInput("name", &core.InputOptions{Required: true})
if err != nil {
core.Error(err.Error(), nil)
os.Exit(1)
}
ac, err := actioncontext.Load()
if err != nil {
core.Error(err.Error(), nil)
os.Exit(1)
}
if pr, ok := ac.PullRequestEvent(); ok {
fmt.Printf("PR #%d\n", pr.GetNumber())
}
core.SetOutput("greeting", "Hello, "+name)
}cmd/example is a complete example.
Tooling is plain Go behind the ./walle task runner: ./walle --help lists the tasks, and ./walle check is the gate CI runs. AGENTS.md has the layout, rules and conventions.
Releases are cut by release-please from Conventional Commits on main: merging its release PR tags vX.Y.Z and publishes the GitHub release. See CHANGELOG.md.
Contributions are welcome; see CONTRIBUTING.md. Report security issues as described in SECURITY.md, not in public issues.