Skip to content

@ghagen/ghagen

Workflow model and related defaults.

Function Description

concurrency

Create a concurrency model that prevents concurrent runs in the same group.

Example

concurrency({
group: "deploy-${{ github.ref }}",
cancelInProgress: true,
})

defaults

Create a defaults model for setting default shell and working directory for all run steps.

Example

defaults({
run: { shell: "bash", workingDirectory: "./src" },
})

workflow

Create a workflow model representing a complete GitHub Actions workflow YAML file. Plain-object values for on, permissions, defaults, and concurrency are automatically wrapped with their respective factory functions.

Example

workflow({
name: "CI",
on: { push: { branches: ["main"] } },
jobs: {
test: job({
runsOn: "ubuntu-latest",
steps: [step({ uses: "actions/checkout@v4" })],
}),
},
})