Examples
Runnable examples live in the lexicon’s examples/ directory. Clone the repo and try them:
cd examples/getting-startednpm installchant build # produces .github/workflows/ci.ymlchant lint # runs lint rulesnpx vitest run # run the testsGetting Started
Section titled “Getting Started”examples/getting-started/ — a CI workflow with build and test steps for a Node.js project.
src/└── ci.ts # Workflow + Job definitionsSource
Section titled “Source”import { Workflow, Job, Step, Checkout, SetupNode } from "@intentius/chant-lexicon-github";
export const workflow = new Workflow({ name: "CI", on: { push: { branches: ["main"] }, pull_request: { branches: ["main"] }, }, permissions: { contents: "read" },});
export const build = new Job({ "runs-on": "ubuntu-latest", timeoutMinutes: 15, steps: [ Checkout({}).step, SetupNode({ nodeVersion: "22", cache: "npm" }).step, new Step({ name: "Install", run: "npm ci" }), new Step({ name: "Build", run: "npm run build" }), new Step({ name: "Test", run: "npm test" }), ],});Generated output
Section titled “Generated output”chant build produces .github/workflows/ci.yml:
name: CIon: push: branches: - main pull_request: branches: - mainpermissions: contents: readjobs: build: runs-on: ubuntu-latest timeout-minutes: 15 steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22' cache: npm - name: Install run: npm ci - name: Build run: npm run build - name: Test run: npm testPatterns demonstrated:
- Typed composites —
Checkout({})andSetupNode({...})instead of rawuses:strings - Permissions — explicit
contents: readfollowing least-privilege - Timeout —
timeoutMinutes: 15prevents runaway jobs - Trigger scoping — push and PR on
mainonly