env

package
v0.14.5 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 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 env provides environment variable handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Token             string       // GITHUB_TOKEN
	Repository        string       // GITHUB_REPOSITORY (format: "owner/repo")
	Ref               string       // GITHUB_REF (e.g., "refs/heads/main" or "refs/pull/42/merge")
	RefName           string       // GITHUB_REF_NAME (e.g., "main" or "42/merge")
	SHA               string       // GITHUB_SHA
	EventName         string       // GITHUB_EVENT_NAME (e.g., "pull_request", "push", "release")
	BaseRef           string       // GITHUB_BASE_REF (only set on pull_request events)
	EventPath         string       // GITHUB_EVENT_PATH (path to event JSON file)
	Output            string       // GITHUB_OUTPUT (path to output file)
	ServerURL         string       // GITHUB_SERVER_URL (defaults to "https://github.com")
	APIURL            string       // GITHUB_API_URL (defaults to "https://api.github.com")
	RunID             string       // GITHUB_RUN_ID
	Actor             string       // GITHUB_ACTOR
	IsGitHubActions   bool         // true if GITHUB_ACTIONS == "true"
	PRNumber          int          // extracted from GITHUB_REF; 0 if not a PR
	HasToken          bool         // true if Token != ""
	PushPayloadLoaded bool         // true when a push event payload was read successfully
	PushBefore        string       // push event before SHA
	PushAfter         string       // push event after SHA
	PushCommits       []PushCommit // commits listed in the push event payload
}

Context holds all GitHub Actions environment variables. Missing variables produce zero values (degraded mode).

func Load

func Load() Context

Load reads all GITHUB_* environment variables and returns a Context. Never errors. Missing vars produce zero values (degraded mode).

type PushCommit added in v0.14.3

type PushCommit struct {
	ID        string
	Message   string
	Timestamp time.Time
}

PushCommit is the subset of a GitHub push event commit used by lint.

Jump to

Keyboard shortcuts

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