env

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 5 Imported by: 0

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