gaji
Type-safe GitHub Actions workflows in TypeScript.
Overview
gaji is a CLI tool that allows developers to write GitHub Actions workflows in TypeScript with full type safety, then compile them to YAML. It automatically fetches action.yml definitions and generates typed wrappers, so you get autocomplete and type checking for every action input and output.
Features
- TypeScript-based workflow authoring with full type safety
- Automatic type generation from
action.ymlfiles - File watching for development (
--watch) - Single binary distribution (Rust)
Installation
From npm
From cargo
Quick Start
# Initialize a new project (creates workflows/ and generated/ directories)
# Add actions and generate types
# Run a one-time dev scan to generate types
# Build workflows to YAML
Usage
Writing Workflows
Create TypeScript files in the workflows/ directory:
import { getAction, Job, Workflow } from "../generated/index.js";
const checkout = getAction("actions/checkout@v5");
const setupNode = getAction("actions/setup-node@v4");
const build = new Job("ubuntu-latest")
.addStep(checkout({}))
.addStep(setupNode({
with: { "node-version": "22" },
}))
.addStep({ name: "Install dependencies", run: "npm ci" })
.addStep({ name: "Run tests", run: "npm test" });
const workflow = new Workflow({
name: "CI",
on: {
push: { branches: ["main"] },
pull_request: { branches: ["main"] },
},
}).addJob("build", build);
workflow.build("ci");
Run gaji build and it outputs .github/workflows/ci.yml.
Commands
gaji init- Initialize a new projectgaji dev- One-time scan and type generationgaji dev --watch- Keep watching for changes after the initial scangaji build- Build TypeScript workflows to YAMLgaji add <action>- Add a new action and generate typesgaji clean- Clean generated files
License
MIT License