env

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 3 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 != ""
}

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).

Jump to

Keyboard shortcuts

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