Skip to content

GHA Env ValidatorType-safe GitHub Actions

Environment variable validation with IntelliSense, Zod v4 metadata, and workflow command helpers

Quick Example โ€‹

typescript
import { addSummary, setOutput, validateEnv } from "@kjanat/gha-env-validator";

// Validate GitHub Actions environment
const env = validateEnv();

// Type-safe access with IntelliSense
console.log(env.GITHUB_SHA); // string
console.log(env.GITHUB_RUN_ID); // number
console.log(env.RUNNER_OS); // "Linux" | "Windows" | "macOS"

// Use workflow commands
setOutput("commit", env.GITHUB_SHA.substring(0, 7));
addSummary("Build", `โœ… Deployed to ${env.RUNNER_OS}`);

Installation โ€‹

bash
npm install @kjanat/gha-env-validator zod
bash
bun add @kjanat/gha-env-validator zod
bash
yarn add @kjanat/gha-env-validator zod
bash
pnpm add @kjanat/gha-env-validator zod

Released under the MIT License.