Skip to content

Commit bae31c3

Browse files
authored
🤖 Add GitHub Copilot CLI support (#1017)
* Copilot CLI support * Copilot CLI support * Copilot CLI support * fix tests * transfer fixes * transfer fixes * changes * changes * changes * fix build * fix build * fix build * fix build * fix build
1 parent 5f560a5 commit bae31c3

22 files changed

Lines changed: 864 additions & 470 deletions

.github/instructions/github-agentic-workflows.instructions.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/dev.lock.yml

Lines changed: 114 additions & 439 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/dev.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
push:
66
branches:
77
- copilot/*
8-
engine: claude
8+
engine: copilot
99
safe-outputs:
1010
staged: true
1111
safe-jobs:

cmd/gh-aw/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ var verbose bool
2020

2121
// validateEngine validates the engine flag value
2222
func validateEngine(engine string) error {
23-
if engine != "" && engine != "claude" && engine != "codex" {
24-
return fmt.Errorf("invalid engine value '%s'. Must be 'claude' or 'codex'", engine)
23+
if engine != "" && engine != "claude" && engine != "codex" && engine != "copilot" {
24+
return fmt.Errorf("invalid engine value '%s'. Must be 'claude', 'codex', or 'copilot'", engine)
2525
}
2626
return nil
2727
}
@@ -285,7 +285,7 @@ func init() {
285285
uninstallCmd.Flags().BoolP("local", "l", false, "Uninstall packages from local .aw/packages instead of global ~/.aw/packages")
286286

287287
// Add AI flag to compile and add commands
288-
compileCmd.Flags().StringP("engine", "a", "", "Override AI engine (claude, codex)")
288+
compileCmd.Flags().StringP("engine", "a", "", "Override AI engine (claude, codex, copilot)")
289289
compileCmd.Flags().Bool("validate", true, "Enable GitHub Actions workflow schema validation (default: true)")
290290
compileCmd.Flags().BoolP("watch", "w", false, "Watch for changes to workflow files and recompile automatically")
291291
compileCmd.Flags().String("workflows-dir", "", "Relative directory containing workflows (default: .github/workflows)")

cmd/gh-aw/main_entry_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ func TestValidateEngine(t *testing.T) {
3333
engine: "codex",
3434
expectErr: false,
3535
},
36+
{
37+
name: "valid copilot engine",
38+
engine: "copilot",
39+
expectErr: false,
40+
},
3641
{
3742
name: "invalid engine",
3843
engine: "gpt4",
@@ -75,7 +80,7 @@ func TestValidateEngine(t *testing.T) {
7580
return
7681
}
7782

78-
if tt.errMessage != "" && err.Error() != fmt.Sprintf("invalid engine value '%s'. Must be 'claude' or 'codex'", tt.engine) {
83+
if tt.errMessage != "" && err.Error() != fmt.Sprintf("invalid engine value '%s'. Must be 'claude', 'codex', or 'copilot'", tt.engine) {
7984
t.Errorf("validateEngine(%q) error message = %v, want to contain %v", tt.engine, err.Error(), tt.errMessage)
8085
}
8186
} else {

docs/src/content/docs/reference/engines.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ sidebar:
77

88
GitHub Agentic Workflows support multiple AI engines to interpret and execute natural language instructions. Each engine has unique capabilities and configuration options.
99

10-
## Available Engines
10+
## Agentic Engines
1111

12-
### Claude (Default)
12+
### Anthropic Claude Code (Default)
1313

1414
Claude Code is the default and recommended AI engine for most workflows. It excels at reasoning, code analysis, and understanding complex contexts.
1515

@@ -29,13 +29,23 @@ engine:
2929
DEBUG_MODE: "true"
3030
```
3131
32-
**Features:**
33-
- Excellent reasoning and code analysis capabilities
34-
- Supports max-turns for cost control
35-
- Uses MCP servers for tool integration
36-
- Generates `mcp-servers.json` configuration
32+
#### Secrets
33+
34+
- `ANTHROPIC_API_KEY` secret is required for authentication.
35+
36+
### GitHub Copilot (Experimental)
3737

38-
### Codex (Experimental)
38+
[GitHub Copilot CLI](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/use-copilot-cli)
39+
40+
```yaml
41+
engine: copilot
42+
```
43+
44+
#### Secrets
45+
46+
- `COPILOT_CLI_TOKEN ` secret is required for authentication.
47+
48+
### OpenAI Codex (Experimental)
3949

4050
OpenAI Codex CLI with MCP server support. Designed for code-focused tasks and integration scenarios.
4151

@@ -72,6 +82,10 @@ engine:
7282
- **`user-agent`** (optional): Custom user agent string for GitHub MCP server configuration
7383
- **`config`** (optional): Additional TOML configuration text appended to generated config.toml
7484

85+
#### Secrets
86+
87+
- `OPENAI_API_KEY` secret is required for authentication.
88+
7589
### Custom Engine
7690

7791
For advanced users who want to define completely custom GitHub Actions steps instead of using AI interpretation.

docs/src/content/docs/tools/cli.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ gh aw logs --start-date -1mo # Last month's runs
232232
# Filter by AI engine type
233233
gh aw logs --engine claude # Only Claude workflows
234234
gh aw logs --engine codex # Only Codex workflows
235+
gh aw logs --engine copilot # Only Copilot workflows
235236

236237
# Filter by branch name
237238
gh aw logs --branch main # Only runs from main branch

pkg/cli/add_command.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ It's a shortcut for:
8585
cmd.Flags().StringP("name", "n", "", "Specify name for the added workflow (without .md extension)")
8686

8787
// Add AI flag to add command
88-
cmd.Flags().StringP("engine", "a", "", "Override AI engine (claude, codex)")
88+
cmd.Flags().StringP("engine", "a", "", "Override AI engine (claude, codex, copilot, custom)")
8989

9090
// Add repository flag to add command
9191
cmd.Flags().StringP("repo", "r", "", "Install and use workflows from specified repository (org/repo)")

pkg/cli/interactive.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ func (b *InteractiveWorkflowBuilder) promptForTrigger() error {
127127
// promptForEngine asks the user to select the AI engine
128128
func (b *InteractiveWorkflowBuilder) promptForEngine() error {
129129
engineOptions := []huh.Option[string]{
130+
huh.NewOption("copilot - GitHub Copilot CLI", "copilot"),
130131
huh.NewOption("claude - Anthropic Claude Code coding agent", "claude"),
131132
huh.NewOption("codex - OpenAI Codex engine", "codex"),
132133
huh.NewOption("custom - Custom engine configuration", "custom"),

pkg/cli/logs.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ Examples:
159159
` + constants.CLIExtensionPrefix + ` logs --start-date -1mo # Filter runs from last month
160160
` + constants.CLIExtensionPrefix + ` logs --engine claude # Filter logs by claude engine
161161
` + constants.CLIExtensionPrefix + ` logs --engine codex # Filter logs by codex engine
162+
` + constants.CLIExtensionPrefix + ` logs --engine copilot # Filter logs by copilot engine
163+
` + constants.CLIExtensionPrefix + ` logs -o ./my-logs # Custom output directory
162164
` + constants.CLIExtensionPrefix + ` logs --branch main # Filter logs by branch name
163165
` + constants.CLIExtensionPrefix + ` logs --branch feature-xyz # Filter logs by feature branch
164166
` + constants.CLIExtensionPrefix + ` logs --after-run-id 1000 # Filter runs after run ID 1000
@@ -257,7 +259,7 @@ Examples:
257259
logsCmd.Flags().String("start-date", "", "Filter runs created after this date (YYYY-MM-DD or delta like -1d, -1w, -1mo)")
258260
logsCmd.Flags().String("end-date", "", "Filter runs created before this date (YYYY-MM-DD or delta like -1d, -1w, -1mo)")
259261
logsCmd.Flags().StringP("output", "o", "./logs", "Output directory for downloaded logs and artifacts")
260-
logsCmd.Flags().String("engine", "", "Filter logs by agentic engine type (claude, codex)")
262+
logsCmd.Flags().String("engine", "", "Filter logs by agentic engine type (claude, codex, copilot)")
261263
logsCmd.Flags().String("branch", "", "Filter runs by branch name (e.g., main, feature-branch)")
262264
logsCmd.Flags().Int64("before-run-id", 0, "Filter runs with database ID before this value (exclusive)")
263265
logsCmd.Flags().Int64("after-run-id", 0, "Filter runs with database ID after this value (exclusive)")
@@ -357,7 +359,7 @@ func DownloadWorkflowLogs(workflowName string, count int, startDate, endDate, ou
357359
if detectedEngine != nil {
358360
// Get the engine ID to compare with the filter
359361
registry := workflow.GetGlobalEngineRegistry()
360-
for _, supportedEngine := range []string{"claude", "codex"} {
362+
for _, supportedEngine := range constants.AgenticEngines {
361363
if testEngine, err := registry.GetEngine(supportedEngine); err == nil && testEngine == detectedEngine {
362364
engineMatches = (supportedEngine == engine)
363365
break
@@ -371,7 +373,7 @@ func DownloadWorkflowLogs(workflowName string, count int, startDate, endDate, ou
371373
if detectedEngine != nil {
372374
// Try to get a readable name for the detected engine
373375
registry := workflow.GetGlobalEngineRegistry()
374-
for _, supportedEngine := range []string{"claude", "codex"} {
376+
for _, supportedEngine := range constants.AgenticEngines {
375377
if testEngine, err := registry.GetEngine(supportedEngine); err == nil && testEngine == detectedEngine {
376378
engineName = supportedEngine
377379
break

0 commit comments

Comments
 (0)