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`.

Related rules

Angular 20 Copilot instructions

Copilot instructions for Angular 20 apps using standalone components, signals, and the new control flow.

GitHub CopilotAngular

Code review Copilot instructions

Copilot instructions focused on pull request review: what to flag, severity labels, and how to word comments.

GitHub CopilotAgent workflows

C# / .NET Copilot path instructions

Path-specific Copilot instructions for C# files on .NET 10: nullable types, async, records, and logging.

GitHub Copilot.NET / ASP.NET Core

Dockerfile Copilot path instructions

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

GitHub CopilotDocker

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.