Write GitHub Actions workflows in TypeScript instead of YAML!
npm install --save-dev @github-actions-workflow-ts/lib @github-actions-workflow-ts/cli// 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: 'Checkout',
uses: 'actions/checkout@v4',
})).addStep(new Step({
name: 'Run tests',
run: 'npm test',
}))
// Every Workflow instance MUST be exported
export const ci = new Workflow('ci', {
name: 'CI',
on: {
push: { branches: ['main'] },
pull_request: { branches: ['main'] },
},
}).addJob(testJob)Generate the YAML:
npx gwf build| Package | Description |
|---|---|
| @github-actions-workflow-ts/lib | Core library (zero dependencies) |
| @github-actions-workflow-ts/cli | CLI for generating YAML files |
| @github-actions-workflow-ts/actions | Typed wrappers for popular actions |
Explore on CodeSandbox:
See the Contributing Guide
MIT
