| name | gen-github-workflow |
| description | Use when creating, modifying, generating, checking, or debugging CI workflow fragments embedded in source code with //<gen-github-workflow> markers. |
gen-github-workflow
Scans source files for //<gen-github-workflow> markers, extracts YAML fragments, deep-merges them by workflow name, and writes .github/workflows/<name>.yml files.
Full specification: SPEC.md
How to Create a CI Workflow
Embed a workflow fragment in any source file using comment markers:
Top-Level Fields
| Field | Purpose |
|---|
name | Required. Determines the output filename and merge key. |
required | If true, added to required-workflows.json. Stripped from output YAML. |
on | GitHub Actions trigger configuration. |
Template Variables
Expanded before YAML parsing:
| Variable | Expands to |
|---|
$$file | Relative path from repo root to the source file |
$$directory | Relative path from repo root to the source file's directory |
Useful for paths: triggers:
Multi-Source Merging
Fragments sharing the same name are deep-merged:
| Key | Strategy |
|---|
on | Union of trigger definitions |
env, permissions | Shallow merge, later wins |
concurrency | Last writer wins |
jobs | Merge by job id; steps arrays concatenated |
Common Patterns
Bun-based CI check:
CLI Commands
bun run src/index.ts generate
bun run src/index.ts check
bun run src/index.ts e2e-test
After editing fragments, run generate and commit the regenerated .github/workflows/*.yml. Workflows with required: true also write to required-workflows.json (used by branch protection IaC). Hand-written workflow files without the AUTO-GENERATED header are never overwritten.
Tooling shape (markers, comment stripping, source headers, hand-written file detection) mirrors gen-skills.