Skip to content

@ghagen/ghagen

Event triggers that start a workflow run.

Function Description

on

Create a trigger configuration model for the on: section of a workflow. Plain-object values for typed trigger fields (push, pullRequest, workflowDispatch, workflowCall, schedule entries) are automatically wrapped with their respective factory functions.

Example

on({
push: { branches: ["main"] },
pullRequest: { branches: ["main"] },
workflowDispatch: true,
})

prTrigger

Create a pull request trigger model for the on.pull_request or on.pull_request_target configuration.

Example

prTrigger({
branches: ["main"],
types: ["opened", "synchronize"],
})

pushTrigger

Create a push trigger model for the on.push configuration.

Example

pushTrigger({
branches: ["main", "release/*"],
paths: ["src/**"],
pathsIgnore: ["docs/**"],
})

scheduleTrigger

Create a schedule trigger model for cron-based workflow execution.

Example

scheduleTrigger({ cron: "0 0 * * 1" }) // Every Monday at midnight

workflowCall

Create a workflow call trigger model for reusable workflow interfaces.

Example

workflowCall({
inputs: {
environment: {
description: "Target environment",
required: true,
type: "string",
},
},
secrets: {
DEPLOY_TOKEN: { description: "Deployment token", required: true },
},
})

workflowDispatch

Create a workflow dispatch trigger model for manual workflow execution.

Example

workflowDispatch({
inputs: {
environment: {
description: "Deployment target",
required: true,
type: "choice",
options: ["staging", "production"],
},
},
})