Skip to content

emmanuelnk/github-actions-workflow-ts

Repository files navigation

github-actions-workflow-ts

Write GitHub Actions workflows in TypeScript instead of YAML!

github-actions-workflow-ts-logo

love opensource license npm version Tests Schema Change Check coverage issues

Quick Install

npm install --save-dev @github-actions-workflow-ts/lib @github-actions-workflow-ts/cli

Quick Example

// 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

Documentation

View Full Documentation

Packages

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

Try It Out

Explore on CodeSandbox:

Contributing

See the Contributing Guide

License

MIT

About

Write Github Actions workflow files in TypeScript (generates JSON and compiles to YAML)

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

Languages