Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 32 additions & 49 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,40 @@
name: "Copilot Setup Steps"

# Automatically run the setup steps when they are changed to allow for easy validation, and
# allow manual testing through the repository's "Actions" tab
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
name: Copilot Setup Steps
"on":
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml

- .github/workflows/copilot-setup-steps.yml
push:
paths:
- .github/workflows/copilot-setup-steps.yml
workflow_dispatch: null
jobs:
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
copilot-setup-steps:
runs-on: ubuntu-latest

# Set the permissions to the lowest permissions possible needed for your steps.
# Copilot will be given its own token for its operations.
permissions:
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
contents: read

# You can define any steps you want, and they will run before the agent starts.
# If you do not check out your code, Copilot will do this for you.
steps:
- name: Checkout code
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5

- name: Set up Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
with:
node-version: "24"
cache: npm
cache-dependency-path: pkg/workflow/js/package-lock.json

- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
with:
go-version-file: go.mod
cache: true

- name: Install JavaScript dependencies
run: npm ci
working-directory: ./pkg/workflow/js

- name: Install development dependencies
run: make deps-dev

- name: Build code
run: make build
continue-on-error: true

- name: Recompile workflows
run: make recompile
continue-on-error: true
- name: Install gh-aw extension
run: curl -fsSL https://raw.githubusercontent.com/githubnext/gh-aw/refs/heads/main/install-gh-aw.sh | bash
- name: Verify gh-aw installation
run: gh aw version
- name: Checkout code
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
- name: Set up Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
with:
cache: npm
cache-dependency-path: pkg/workflow/js/package-lock.json
node-version: "24"
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
with:
cache: true
go-version-file: go.mod
- name: Install JavaScript dependencies
run: npm ci
- name: Install development dependencies
run: make deps-dev
- name: Build code
run: make build
- name: Recompile workflows
run: make recompile
7 changes: 5 additions & 2 deletions .vscode/mcp.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"servers": {
"github-agentic-workflows": {
"command": "./gh-aw",
"args": ["mcp-server", "--cmd", "./gh-aw"],
"command": "gh",
"args": [
"aw",
"mcp-server"
],
"cwd": "${workspaceFolder}"
}
}
Expand Down
30 changes: 23 additions & 7 deletions pkg/cli/init_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@ This command:
- Creates the debug agentic workflow agent at .github/agents/debug-agentic-workflow.agent.md
- Removes old prompt files from .github/prompts/ if they exist

By default (without --no-mcp):
- Creates .github/workflows/copilot-setup-steps.yml with gh-aw installation steps
- Creates .vscode/mcp.json with gh-aw MCP server configuration

With --no-mcp flag:
- Skips creating GitHub Copilot Agent MCP server configuration files

With --tokens flag:
- Validates which required and optional secrets are configured
- Provides commands to set up missing secrets for the specified engine
- Use with --engine flag to check engine-specific tokens (copilot, claude, codex)

With --mcp flag:
- Creates .github/workflows/copilot-setup-steps.yml with gh-aw installation steps
- Creates .vscode/mcp.json with gh-aw MCP server configuration

With --codespaces flag:
- Creates .devcontainer/gh-aw/devcontainer.json with universal image (in subfolder to avoid conflicts)
- Configures permissions for current repo: actions:write, contents:write, discussions:read, issues:read, pull-requests:write, workflows:write
Expand All @@ -54,19 +57,28 @@ After running this command, you can:
Examples:
` + constants.CLIExtensionPrefix + ` init
` + constants.CLIExtensionPrefix + ` init -v
` + constants.CLIExtensionPrefix + ` init --mcp
` + constants.CLIExtensionPrefix + ` init --no-mcp
` + constants.CLIExtensionPrefix + ` init --tokens --engine copilot
` + constants.CLIExtensionPrefix + ` init --codespaces
` + constants.CLIExtensionPrefix + ` init --codespaces repo1,repo2`,
RunE: func(cmd *cobra.Command, args []string) error {
verbose, _ := cmd.Flags().GetBool("verbose")
mcp, _ := cmd.Flags().GetBool("mcp")
mcpFlag, _ := cmd.Flags().GetBool("mcp")
noMcp, _ := cmd.Flags().GetBool("no-mcp")
campaign, _ := cmd.Flags().GetBool("campaign")
tokens, _ := cmd.Flags().GetBool("tokens")
engine, _ := cmd.Flags().GetString("engine")
codespaceReposStr, _ := cmd.Flags().GetString("codespaces")
codespaceEnabled := cmd.Flags().Changed("codespaces")

// Determine MCP state: default true, unless --no-mcp is specified
// --mcp flag is kept for backward compatibility (hidden from help)
mcp := !noMcp
if cmd.Flags().Changed("mcp") {
// If --mcp is explicitly set, use it (backward compatibility)
mcp = mcpFlag
}

// Trim the codespace repos string (NoOptDefVal uses a space)
codespaceReposStr = strings.TrimSpace(codespaceReposStr)

Expand All @@ -90,13 +102,17 @@ Examples:
},
}

cmd.Flags().Bool("mcp", false, "Configure GitHub Copilot Agent MCP server integration")
cmd.Flags().Bool("no-mcp", false, "Skip configuring GitHub Copilot Agent MCP server integration")
cmd.Flags().Bool("mcp", false, "Configure GitHub Copilot Agent MCP server integration (deprecated, MCP is enabled by default)")
cmd.Flags().Bool("campaign", false, "Install the Campaign Designer agent for gh-aw campaigns in this repository")
cmd.Flags().Bool("tokens", false, "Validate required secrets for agentic workflows")
cmd.Flags().String("engine", "", "AI engine to check tokens for (copilot, claude, codex) - requires --tokens flag")
cmd.Flags().String("codespaces", "", "Create devcontainer.json for GitHub Codespaces with agentic workflows support. Specify comma-separated repository names in the same organization (e.g., repo1,repo2), or use without value for current repo only")
// NoOptDefVal allows using --codespaces without a value (returns empty string when no value provided)
cmd.Flags().Lookup("codespaces").NoOptDefVal = " "

// Hide the deprecated --mcp flag from help (kept for backward compatibility)
_ = cmd.Flags().MarkHidden("mcp")

return cmd
}
Loading