Home › GitHub Actions › GitHub Actions Copilot path instructions

GitHub Actions Copilot path instructions

Path-specific Copilot instructions for .github/workflows YAML: least privilege, pinned actions, and injection-safe steps.

GitHub CopilotGitHub Actions

How to use

Save this as .github/instructions/workflows.instructions.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

.github/instructions/workflows.instructions.mdDownload  
---
applyTo: ".github/workflows/**,.github/actions/**"
description: Rules for CI workflows
---

# GitHub Actions workflows

- Top-level `permissions: contents: read`; grant more per job only as needed (`pull-requests: write`, `id-token: write`).
- Pin third-party actions to a full commit SHA with a version comment.
- Untrusted context (`github.event.*.title`, `body`, `head_ref`) never goes inside `run:` directly. Map it to `env:` and use `"$VAR"`.
- Don't combine `pull_request_target` with checking out and running PR code.
- Use OIDC for cloud credentials; no long-lived cloud keys in secrets.
- Every job has `timeout-minutes`. PR workflows have `concurrency` with `cancel-in-progress: true`.
- Use setup actions' built-in caching before custom caches.
- Matrix builds for supported runtime versions; keep the matrix small.
- Share logic via reusable workflows (`workflow_call`) or composite actions.
- Steps have `name:`s that read well in the UI.

## Check
`actionlint` passes; for security-sensitive workflows also run `zizmor`.

More: all GitHub Actions rules · all GitHub Copilot rules

Related rules

GitHub Actions workflow rules

Cursor rules for writing secure, fast GitHub Actions workflows: permissions, pinning, caching, and concurrency.

CursorGitHub Actions

Dockerfile Copilot path instructions

Path-specific Copilot instructions for Dockerfiles and compose files: multi-stage builds, non-root, and pinned images.

GitHub CopilotDocker

Terraform Copilot instructions

Copilot instructions for Terraform 1.x / OpenTofu infrastructure: modules, state safety, variables, and plan review.

GitHub CopilotTerraform

AWS CDK (TypeScript) CLAUDE.md

CLAUDE.md for AWS CDK v2 apps in TypeScript: constructs, least-privilege grants, snapshot tests, and safe deploys.

Claude Code (CLAUDE.md)AWS CDK

Docker & Compose AGENTS.md

AGENTS.md for containerized projects: lean multi-stage Dockerfiles, Docker Compose for local dev, and image security.

AGENTS.mdDocker

Kubernetes & Helm CLAUDE.md

CLAUDE.md for Kubernetes manifests and Helm 3 charts: resources, probes, security context, and safe rollouts.

Claude Code (CLAUDE.md)Kubernetes / Helm

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.