A GitHub Action wrapper for the GitHub Copilot CLI that enables AI-powered automation in your workflow files.
Add the copilot-requests: write permission to your workflow. The default GITHUB_TOKEN now handles Copilot authentication β no PAT required.
Important
Declaring a permissions: block sets every scope you do not list to none. Always include contents: read if you check out the repo, and copilot-requests: write or Copilot auth will fail.
Note
Your organization must have the "Allow use of Copilot CLI billed to the organization" policy enabled.
Add the following workflow to your .github/workflows folder:
name: 'Copilot Automation'
on: [pull_request]
permissions:
contents: read
copilot-requests: write
pull-requests: write
jobs:
copilot:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v7
- name: 'Run Copilot CLI'
uses: austenstone/copilot-cli@v4
with:
prompt: |
Review this pull request for:
1. Code quality and best practices
2. Security vulnerabilities
3. Performance implications
4. Documentation completeness prompt: 'What time is it?'
mcp-config: |
{
"mcpServers": {
"time": {
"type": "local",
"command": "uvx",
"args": ["mcp-server-time", "--local-timezone", "America/New_York"],
"tools": ["*"]
}
}
}Use secret-env-vars to strip and redact sensitive values from shell/MCP environments and logs, and context: long_context to give the agent a larger context window for big codebases:
- name: 'Run Copilot CLI'
uses: austenstone/copilot-cli@v4
env:
API_KEY: ${{ secrets.API_KEY }}
with:
prompt: 'Audit the codebase for hard-coded credentials and summarize findings.'
secret-env-vars: 'API_KEY'
context: 'long_context'| Parameter | Description | Required | Default |
|---|---|---|---|
prompt |
Natural language prompt to send to GitHub Copilot | β | - |
copilot-token |
(Deprecated) Override token for Copilot auth. The default github.token now works. |
β | github.token |
repo-token |
Token for repository operations (gh CLI). Use a PAT if the agent needs elevated permissions. |
β | github.token |
copilot-config |
Copilot CLI settings (JSON), merged into ~/.copilot/settings.json (or config.json on CLIs older than 1.0.35) |
β | See below |
mcp-config |
MCP server configuration in JSON format | β | - |
| Agent Behavior | |||
autopilot |
Enable autopilot continuation in prompt mode | β | true |
max-turns |
Maximum number of autopilot continuation turns | β | CLI default (5) |
mode |
Initial agent mode (interactive, plan, or autopilot). When set, it overrides the autopilot toggle. |
β | - |
no-ask-user |
Disable ask_user tool for fully autonomous CI execution | β | true |
silent |
Output only the agent response without usage statistics | β | false |
model |
AI model to use (e.g., "claude-sonnet-4.6", "claude-opus-4.8", "gpt-5.5") |
β | - |
agent |
Specify a custom agent to use (e.g., "explore") |
β | - |
reasoning-effort |
Reasoning effort level (none, low, medium, high, xhigh, max) |
β | - |
context |
Context window tier (default or long_context). Useful for large repos. |
β | - |
attachments |
Comma-separated file paths (images or native documents) to attach to the prompt | β | - |
experimental |
Enable experimental CLI features | β | false |
| Tool Permissions | |||
allow-all-tools |
Allow all tools without approval | β | true |
allowed-tools |
Comma-separated list of tools to allow (e.g., "shell(git:*)") |
β | - |
denied-tools |
Comma-separated list of tools to deny (e.g., "shell(rm)") |
β | - |
available-tools |
Comma-separated allowlist β only these tools are available to the model | β | - |
excluded-tools |
Comma-separated tools to hide from the model | β | - |
allowed-urls |
Comma-separated list of URLs/domains to allow | β | - |
denied-urls |
Comma-separated list of URLs/domains to deny | β | - |
allow-all-urls |
Allow access to all URLs without confirmation | β | false |
allow-all-paths |
Allow access to any file path without approval. When false (default), the agent is scoped to the workspace instead of the entire filesystem |
β | false |
secret-env-vars |
Comma-separated env var names whose values are stripped from shell/MCP environments and redacted from output/logs (e.g., "API_KEY,DB_PASSWORD") |
β | - |
| MCP Configuration | |||
enable-all-github-mcp-tools |
Enable all GitHub MCP tools | β | false |
add-github-mcp-tools |
Comma-separated list of specific GitHub MCP tools to enable | β | - |
add-github-mcp-toolsets |
Comma-separated list of GitHub MCP toolsets to enable | β | - |
disable-mcp-servers |
Comma-separated list of MCP servers to disable | β | - |
disable-builtin-mcps |
Disable all built-in MCP servers (currently only github-mcp-server) |
β | false |
additional-mcp-config |
Comma-separated extra MCP server configs (JSON string or @file path) that augment the merged MCP config |
β | - |
| Files & Directories | |||
additional-directories |
Comma-separated list of additional directories to trust | β | - |
disallow-temp-dir |
Prevent automatic access to the system temp directory | β | false |
plugin-dir |
Comma-separated local plugin directories to load | β | - |
| Session Management | |||
resume-session |
Resume from a previous session ID (use "latest" for most recent) |
β | - |
session-id |
Resume an existing session/task by ID, or set the UUID for a new session | β | - |
name |
Set a human-friendly name for the session | β | - |
enable-memory |
Enable cross-session memory in prompt mode | β | false |
share |
Share session to a markdown file after completion | β | - |
share-gist |
Share session to a secret GitHub gist | β | false |
| Output & Logging | |||
output-format |
Output format (json for JSONL output) |
β | - |
log-level |
Log level: none, error, warning, info, debug, all |
β | all |
upload-artifact |
Upload Copilot logs as workflow artifacts | β | true |
fail-on-error |
Fail the step if Copilot CLI exits with non-zero code | β | false |
copilot-version |
Version spec of the Copilot CLI to install. Examples: 1.0.80, 1.x, >=1.0.80, latest, prerelease. |
β | 1.0.80 |
options |
Additional CLI flags (e.g., "--no-custom-instructions") |
β | --screen-reader --no-color --stream off |
The action installs a pinned, known-good CLI by default so a CLI release can't
change your workflow's behavior overnight. copilot-version accepts any npm
version spec, so you choose your own tradeoff between stability and freshness:
copilot-version: '1.0.80' # exact pin (default)
copilot-version: '1.x' # newest 1.x
copilot-version: '>=1.0.80' # floor, no ceiling
copilot-version: 'latest' # newest stable
copilot-version: 'prerelease' # bleeding edgeNote
copilot-config is written to ~/.copilot/settings.json. CLI versions older
than 1.0.35 read user settings from config.json instead β the action
detects this and writes to the correct file, warning you when it does.
| Output | Description |
|---|---|
exit-code |
Exit code from the Copilot CLI command |
logs-path |
Path to the copilot logs directory |
session-path |
Path to the shared session markdown file (when share is used) |
The action supports Model Context Protocol (MCP) servers for extending Copilot's capabilities. Configure MCP servers using JSON format with an mcpServers object where each key is the server name and the value contains its configuration.
Important
See the official MCP server configuration docs for complete details.
π View All Example Workflows
| Workflow | Description |
|---|---|
| Actions Report | Analyzes the last 100 workflow runs and opens a workflow optimization report issue |
| CI Fix | Automatically analyzes failed workflow runs and creates a pull request with fixes |
| Comment Trigger | Responds to issue comments starting with /copilot and executes the requested task |
| Dependabot Analysis | Reviews Dependabot PRs with detailed dependency analysis, breaking changes, and migration guidance |
| PR Review | Performs comprehensive autonomous code reviews on pull requests with severity-based feedback |
| Research | Conducts deep research on GitHub issues using Firecrawl to gather and synthesize information |
| Security Triage | Triages all security alerts (Dependabot, Secret Scanning, Code Scanning) into a single comprehensive report |
| Issue Triage | Automatically labels issues based on their title and content using existing repository labels |
| Usage Report | Generates comprehensive Copilot usage reports and analytics |
Note
Most issues stem from permissions configuration.
-
"Copilot token required" / "Authentication failed" / Permission Denied
- Ensure your workflow has
copilot-requests: writepermission - If you declare any
permissions:block, you must listcopilot-requests: writeexplicitly. Declaring a block drops every scope you do not name, and Copilot auth fails without it. - Your org must enable the "Allow use of Copilot CLI billed to the organization" policy
- If using a legacy PAT, ensure it has the "Copilot Requests" permission
- Ensure your workflow has
-
Job is green but Copilot did nothing
fail-on-errordefaults tofalse, so a failed Copilot run still passes the step- Check the job log for a
Copilot CLI exited with code ...warning, which usually means missingcopilot-requests: write - Set
fail-on-error: trueto turn these into hard failures
-
Copilot starts but permission denied on repo operations
- Add appropriate permissions (e.g.,
contents: write,pull-requests: write) - Check Settings > Actions > General > Workflow permissions
- Add appropriate permissions (e.g.,
-
Tool Access Denied
- Check your
allowed-toolsanddenied-toolsconfiguration - If
allow-all-tools: false, you must explicitly allow needed tools
- Check your
-
MCP Server Connection Issues
- Verify MCP server URLs are accessible from GitHub-hosted runners
- Check authentication headers and tokens
- Ensure
typeis set correctly (local,http, orsse)
-
Session Resume Not Working
- Session data is stored in logs; ensure
upload-artifact: true - Use
resume-session: latestto continue the most recent session
- Session data is stored in logs; ensure
-
Large Output Truncation
- Set
log-level: errororlog-level: warningto reduce verbosity - Break complex prompts into smaller, focused tasks
- Set