github-action — Claude Code rule: what it does, how to install
Guides Claude Code in generating GitHub Actions workflows with scoped secrets, composite steps, and upstream version checks.
AGPL-3.0 ★ 267 updated 2026-02-20
.cursor/rules/github-action.mdcWhat github-action does
The rule shapes how Claude Code writes CI/CD pipelines. It directs the assistant to scan the project root first, inspecting scripts in package.json, Node versions in .nvmrc, and variable definitions in .env.example. Branch naming is confirmed directly via git branch -a | cat.
Workflows must keep environment variables and tokens bound to jobs rather than declared across the entire workflow. Node modules rely on npm ci. Repeated logic moves into dedicated composite actions in separate files.
At the end of workflow editing, the agent queries GitHub endpoints via curl to grab the latest major releases, verify the source repo is not archived, and inspect action.yml when parameters trigger linter errors. Without network reachability and curl in the terminal, these upstream checks cannot finish.
What it helps with
- scaffold a GitHub Actions workflow matching local package scripts
- audit third-party actions against GitHub API for archived status
- extract duplicate pipeline steps into standalone composite actions
- scope secrets and environment variables to individual jobs
Example prompts for the agent
- Create a continuous integration workflow for this project following the github-action rule
- Review
.github/workflows/test.ymland check if any actions are archived or outdated - Extract repetitive setup steps from our workflows into a composite action
How to install github-action
Manually: put the files in place
.cursor/rules/github-action.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/github-action.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/github-action.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/github-action.mdManually: put the files in place
.clinerules/github-action.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about github-action
How to install github-action in Claude Code?
Place the rule contents into .claude/rules/github-action.md inside your project directory.
What does the github-action rule enforce?
It enforces job-scoped variables, npm ci for dependency installation, extraction of composite actions, and automated verification of action tags and repository status.
Why does this rule run terminal curl commands?
It queries GitHub APIs to discover the latest major release tag, confirm the repository is not archived, and read raw action.yml files when handling linter issues.