Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,43 @@ Write GitHub Actions workflows in TypeScript instead of YAML!
<a href="https://github.com/emmanuelnk/github-actions-workflow-ts/actions">
<img src="https://emmanuelnk.github.io/github-actions-workflow-ts/badges/coverage.svg" alt="coverage">
</a>
<a href="https://github.com/emmanuelnk/github-actions-workflow-ts/issues">
<img src="https://img.shields.io/github/issues/emmanuelnk/github-actions-workflow-ts.svg" alt="issues">
</a>
</p>

## Quick Install

```bash
npm install --save-dev @github-actions-workflow-ts/lib @github-actions-workflow-ts/cli
npm install --save-dev \
@github-actions-workflow-ts/lib \ # types for workflows
@github-actions-workflow-ts/cli \ # generates the yaml
@github-actions-workflow-ts/actions # types for popular gha actions
```

## Quick Example

```typescript
// workflows/ci.wac.ts
import { Workflow, NormalJob, Step, expressions as ex, dedentString as ds } from '@github-actions-workflow-ts/lib'
import { ActionsCheckoutV4, ActionsSetupNodeV4 } from '@github-actions-workflow-ts/actions'
import {
Workflow,
NormalJob,
Step,
expressions as ex,
dedentString as ds
} from '@github-actions-workflow-ts/lib'
import {
ActionsCheckoutV4,
ActionsSetupNodeV4
} from '@github-actions-workflow-ts/actions'

// Typed actions give you autocomplete on `with` inputs and typed `outputs`
const checkout = new ActionsCheckoutV4({
name: 'Checkout',
})

const setupNode = new ActionsSetupNodeV4({
id: 'setup-node',
name: 'Setup Node.js',
// Typed actions give you autocomplete on `with` inputs and typed `outputs`
with: {
'node-version': '20.x', // ← autocomplete for all valid inputs
'node-version': '20.x',
cache: 'npm',
},
})
Expand All @@ -75,7 +84,8 @@ const test = new Step({
run: 'npm test',
env: {
CI: 'true',
NODE_AUTH_TOKEN: ex.secret('NPM_TOKEN'), // ← expression helpers -> ${{ secrets.NPM_TOKEN }}
// you can use expression helpers -> ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ex.secret('NPM_TOKEN'),
},
})

Expand Down