Type-safe GitHub Actions workflow builder - Library
npm install @github-actions-workflow-ts/libType-safe GitHub Actions workflow builder library for TypeScript.
Stop writing workflows in YAML and use TypeScript instead!
Install both the library and CLI to write workflows in TypeScript and generate YAML files:
``bash`
npm install --save-dev @github-actions-workflow-ts/lib @github-actions-workflow-ts/cli
If you only want to generate workflow JSON objects and handle YAML file generation yourself, install just the zero-dependency library:
`bash`
npm install --save-dev @github-actions-workflow-ts/lib
The library package has zero dependencies and works in both ESM and CommonJS projects.
`ts
import { Workflow, NormalJob, Step } from '@github-actions-workflow-ts/lib'
const checkoutStep = new Step({
name: 'Checkout',
uses: 'actions/checkout@v3',
})
const testJob = new NormalJob('Test', {
'runs-on': 'ubuntu-latest',
'timeout-minutes': 2
})
export const exampleWorkflow = new Workflow('example-filename', {
name: 'Example',
on: {
workflow_dispatch: {}
}
})
testJob.addStep(checkoutStep)
exampleWorkflow.addJob(testJob)
`
For full documentation, examples, and API reference, visit the main repository.
- Type Safety: Full TypeScript support with types generated from the official GitHub Actions Workflow JSON Schema
- Zero Dependencies: The library has no external dependencies
- Dual Module Support: Works with both ESM and CommonJS projects
- Intuitive API: Builder pattern for constructing workflows, jobs, and steps
- Expression Helpers: Utilities for GitHub Actions expressions like ${{ secrets.TOKEN }}`
MIT