Skip to main content
github-actions-workflow-ts logo

github-actions-workflow-ts

Write GitHub Actions workflows in TypeScript instead of YAML

Type Safety

Full TypeScript support with auto-generated types from the official GitHub Actions schema. Catch errors at compile time.

Reusable Components

Define steps, jobs, and workflows once and reuse them across your projects. No more copy-pasting YAML.

Zero Dependencies

The core library has zero runtime dependencies and works in both ESM and CommonJS projects.

Write TypeScript, Generate YAML

1

Write your workflow in TypeScript

workflows/ci.wac.ts
import { Workflow, NormalJob, Step } from '@github-actions-workflow-ts/lib'

const testJob = new NormalJob('test', {
'runs-on': 'ubuntu-latest',
}).addStep(new Step({
name: 'Run tests',
run: 'npm test',
}))

export const ci = new Workflow('ci', {
name: 'CI',
on: { push: { branches: ['main'] } },
}).addJob(testJob)
2

Run the build command

npx gwf build
3

Get your generated YAML workflow file

.github/workflows/ci.yml
# Generated by github-actions-workflow-ts
name: CI
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Run tests
run: npm test