Write a GitHub Actions workflow
Writes a secure, cached and least-privilege GitHub Actions workflow that fits the repository's real build and test commands. Use when adding CI, a release job or a scheduled task.
Most CI workflows are copied from a template and then patched until they pass. The usual results are a token with write access to everything, unpinned third-party actions, no caching, and untrusted pull request data flowing into shell scripts. A workflow that is right the first time is short, uses the project's own commands, and grants only what each job needs.
Write a GitHub Actions workflow that does this: Only if [REQUIREMENTS] is given: Requirements:
- Inspect the repository first: languages, package manager and lockfile, the scripts or make targets that lint, build and test, runtime version files (
.nvmrc,.python-version,go.mod,rust-toolchain.toml), and the workflows already in.github/workflows/. Reuse existing commands instead of inventing new ones. - Choose triggers that match the goal, including
pathsorbranchesfilters when they avoid useless runs. - Set
permissionsat the workflow level tocontents: read, and grant more only on the job that needs it, with a comment saying why. - Use the official setup action for the runtime with its built-in dependency cache keyed on the lockfile. Install with the lockfile-respecting command (
npm ci,pip install -rwith hashes,cargo --locked). - Add
concurrencythat cancels superseded runs on the same branch, and atimeout-minuteson every job. - Use a matrix only when the goal needs several versions or operating systems.
- Write the file to
.github/workflows/<name>.yml. Ifactionlintis available, run it and fix what it reports.
- Pin every third-party action to a full commit SHA with the version in a trailing comment. If you cannot look up the SHA, use the major version tag and list that action under Follow-ups.
- Use only actions you are certain exist. Never invent an action name or an input.
- Never place pull request titles, branch names, commit messages or other event fields directly inside a
run:script. Pass them throughenv:and quote the variable. - Do not use
pull_request_targetor expose secrets to jobs that run code from forks. - Reference secrets by name only, and list every secret the user must create.
- Do only what was asked. If you notice something else worth changing, mention it in one line at the end instead of changing it.
- Keep the change as small as it can be while still being correct.
- Before saying the work is done, run the check that proves it (tests, build, type check or the command the user gave) and report the real result.
- If you could not run a check, say so plainly and say which one.
Workflow
The path, then the complete YAML file.
Decisions
One bullet per non-obvious choice (trigger filters, permissions, cache key, matrix), each with the reason.
Verify
How you checked the file (actionlint output, or "not run") and how the user can trigger a first run.
Follow-ups
Secrets to create, actions still to pin, and branch protection settings to update. "None" if empty.
1 required value still a placeholder; the assistant will ask for it.
details
- kind
- Prompt: a task you run by name to get one finished thing back
- domain
- Software engineering
- category
- DevOps
- level
- Intermediate
- made for
- DevOps / platform engineer, Software engineer
- needs
- repo-read, file-write
- risk
- edits-files
- version
- v1.0.0 · experimental
- reviewed
- 2026-10-02
- works in
- Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Antigravity, OpenCode, Windsurf, Zed, Continue, AGENTS.md
use in
npx @hermes-hq/hodios install write-github-actions-workflow --target claude-codenpx skills add hermes-hq/hodios-dist --skill write-github-actions-workflow -a claude-codeclaude plugin marketplace add hermes-hq/hodios-distclaude plugin install hodios-software-engineering@hodiosThe plugin brings every entry in this domain at once.
pairs well with
All of DevOpsSpeed up a CI pipeline
Analyses a slow CI configuration and its job timings, then proposes caching, parallelism and test splitting with the minutes each change saves. Use when builds are slowing the team down.
speed-up-ci-pipelineDesign a deployment strategy
Chooses and specifies a deployment strategy (rolling, blue-green, canary or feature-flagged) with health gates, automated rollback triggers and database-change ordering. Use when deploys feel risky.
design-deployment-strategyReview a Dockerfile
Reviews a Dockerfile for security, image size, build cache use and runtime correctness, and returns ranked findings with a corrected file. Use before shipping a new or changed container image.
review-dockerfileReview an infrastructure plan before apply
Reviews a Terraform, OpenTofu or other IaC plan for destructive changes, security exposure, cost surprises and changes outside the stated intent. Use before running apply, especially in production.
review-iac-planWrite a Docker Compose dev environment
Writes a Docker Compose local development setup that mirrors production dependencies, with health checks, named volumes, seed data, env files and a one-command start. Use when onboarding developers.
write-docker-composeDevOps engineer
Acts as a DevOps engineer who automates the second time, keeps pipelines fast and reproducible, and makes every change reversible. Use for CI/CD, infrastructure and release work.
devops-engineer