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)
- Host: GitHub
- URL: https://github.com/emmanuelnk/github-actions-workflow-ts
- Owner: emmanuelnk
- License: mit
- Created: 2023-08-26T21:00:45.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-18T16:09:48.000Z (3 months ago)
- Last Synced: 2026-01-18T16:17:14.403Z (3 months ago)
- Topics: actions, cicd, github-actions, javascript, typescript, yaml
- Language: TypeScript
- Homepage:
- Size: 471 KB
- Stars: 143
- Watchers: 3
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# github-actions-workflow-ts
Write GitHub Actions workflows in TypeScript instead of YAML!

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