Skip to content

commandDevOps and cloudgithub-actions

Setup GitHub Actions

Creates a GitHub Actions workflow that installs with a cache, runs lint, tests and build, and uses least-privilege permissions.

npx workspacetemplates add setup-github-actions --tool claude-code

Writes 1 file to .claude/commands/

.claude/commands/setup-github-actions.md15 lines · 1.3 KBFile
---
description: Creates a GitHub Actions workflow that installs with a cache, runs lint, tests and build, and uses least-privilege permissions.
argument-hint: "[extras, e.g. matrix of Node versions]"
---

Set up GitHub Actions CI for this project. Extra requirements: $ARGUMENTS

1. Check `.github/workflows/` for existing files. If a CI workflow exists, propose edits instead of a new file.
2. Read the manifest and scripts to find the exact commands for install, lint, typecheck, test and build. Find the language version from .nvmrc, .python-version, go.mod or the engines field, and use it.
3. Write `.github/workflows/ci.yml` triggered on pull_request and on push to the default branch. Set `permissions: contents: read` at the top, add a `concurrency` group that cancels older runs of the same branch, and set `timeout-minutes`.
4. Use the official setup action for the language with its built-in cache option, and install with the lockfile command (`npm ci`, `pip install -r`, `go mod download`).
5. Run lint and tests as separate steps so a failure shows which one broke. Upload test reports only when the project already produces them.
6. Pin third-party actions to a major version tag, or a commit SHA for non-GitHub publishers.

Show the file and list the secrets it would need (none, ideally). Ask before saving, and do not commit.

What it does

A good CI file is short, fast and strict about what it can touch. This command reads your project to find the real install, lint, test and build commands, then writes a workflow that runs them in a sensible order.

It pins action versions, turns on dependency caching and limits the token to read access. Nothing is committed or pushed.

Example

you › /setup-github-actions test on Node 20 and 22

agent › Proposed ci.yml: jobs lint and test (matrix 20, 22), npm cache enabled, permissions read-only, concurrency cancels stale runs. No secrets needed. Estimated run time with warm cache: about 2 minutes. Save the file?

Questions

Does it push the workflow for me?
No. It writes the file after you agree and leaves committing and pushing to you.
Can it add deployment steps?
It sets up checks only. Deploy jobs need secrets and environments that you should design on purpose.
  • Debug Container

    Commanddocker

    Free
  • Deploy Checklist

    CommandDevOps and cloud

    Free
  • Dockerize

    Commanddocker

    Free
  • Document Env Vars

    CommandDevOps and cloud

    Free