An open API service indexing awesome lists of open source software.

https://github.com/emmanuelnk/github-actions-workflow-ts

Write Github Actions workflow files in TypeScript (generates JSON and compiles to YAML)
https://github.com/emmanuelnk/github-actions-workflow-ts

actions cicd github-actions javascript typescript yaml

Last synced: 2 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# 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

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

## Quick Example

```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: '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:

```bash
npx gwf build
```

See more examples in the [./examples](./examples) folder and their respective output in [./.github/workflows](./.github/workflows).

## Documentation

**[View Full Documentation](https://github-actions-workflow-ts.vercel.app/)**

- [Installation](https://github-actions-workflow-ts.vercel.app/docs/getting-started/installation)
- [Quick Start](https://github-actions-workflow-ts.vercel.app/docs/getting-started/quick-start)
- [Writing Workflows](https://github-actions-workflow-ts.vercel.app/docs/guides/writing-workflows)
- [Helpers](https://github-actions-workflow-ts.vercel.app/docs/core-concepts/helpers)
- [Typed Actions](https://github-actions-workflow-ts.vercel.app/docs/guides/typed-actions)
- [API Reference](https://github-actions-workflow-ts.vercel.app/docs/api-reference)

## Packages

| Package | Description |
|---------|-------------|
| [@github-actions-workflow-ts/lib](https://www.npmjs.com/package/@github-actions-workflow-ts/lib) | Core library (zero dependencies) |
| [@github-actions-workflow-ts/cli](https://www.npmjs.com/package/@github-actions-workflow-ts/cli) | CLI for generating YAML files |
| [@github-actions-workflow-ts/actions](https://www.npmjs.com/package/@github-actions-workflow-ts/actions) | Typed wrappers for popular actions |

## Try It Out

Explore on CodeSandbox:
- [Simple Example](https://codesandbox.io/p/devbox/github-actions-workflow-ts-2vthc5?file=%2Fsrc%2Fworkflows%2Fsimple.example.wac.ts)
- [Advanced Example](https://codesandbox.io/p/devbox/github-actions-workflow-ts-2vthc5?file=%2Fsrc%2Fworkflows%2Fadvanced.example.wac.ts)

## Contributing

See the [Contributing Guide](https://github-actions-workflow-ts.vercel.app/docs/contributing/development-setup)

## License

MIT