MCPcopy Create free account
hub / github.com/github/gh-aw / generateCopilotSetupStepsYAML

Function generateCopilotSetupStepsYAML

pkg/cli/copilot_setup.go:49–110  ·  view source on GitHub ↗

generateCopilotSetupStepsYAML generates the copilot-setup-steps.yml content based on action mode

(ctx context.Context, actionMode workflow.ActionMode, version string, resolver workflow.SHAResolver)

Source from the content-addressed store, hash-verified

47
48// generateCopilotSetupStepsYAML generates the copilot-setup-steps.yml content based on action mode
49func generateCopilotSetupStepsYAML(ctx context.Context, actionMode workflow.ActionMode, version string, resolver workflow.SHAResolver) string {
50 // Determine the action reference - use SHA-pinned or version tag in release/action mode, @main in dev mode
51 actionRef := getActionRef(ctx, actionMode, version, resolver)
52
53 if actionMode.IsRelease() || actionMode.IsAction() {
54 // Determine the action repo based on mode
55 actionRepo := "github/gh-aw-actions/setup-cli"
56 return fmt.Sprintf(`name: "Copilot Setup Steps"
57
58# This workflow configures the environment for GitHub Copilot Agent with gh-aw MCP server
59on:
60 workflow_dispatch:
61 push:
62 paths:
63 - .github/workflows/copilot-setup-steps.yml
64
65jobs:
66 # The job MUST be called 'copilot-setup-steps' to be recognized by GitHub Copilot Agent
67 copilot-setup-steps:
68 runs-on: ubuntu-latest
69
70 # Set minimal permissions for setup steps
71 # Copilot Agent receives its own token with appropriate permissions
72 permissions:
73 contents: read
74
75 steps:
76 - name: Checkout repository
77 uses: actions/checkout@v6
78 - name: Install gh-aw extension
79 uses: %s%s
80 with:
81 version: %s
82`, actionRepo, actionRef, version)
83 }
84
85 // Default (dev/script mode): use curl to download install script
86 return `name: "Copilot Setup Steps"
87
88# This workflow configures the environment for GitHub Copilot Agent with gh-aw MCP server
89on:
90 workflow_dispatch:
91 push:
92 paths:
93 - .github/workflows/copilot-setup-steps.yml
94
95jobs:
96 # The job MUST be called 'copilot-setup-steps' to be recognized by GitHub Copilot Agent
97 copilot-setup-steps:
98 runs-on: ubuntu-latest
99
100 # Set minimal permissions for setup steps
101 # Copilot Agent receives its own token with appropriate permissions
102 permissions:
103 contents: read
104
105 steps:
106 - name: Install gh-aw extension

Callers 1

Calls 3

getActionRefFunction · 0.85
IsReleaseMethod · 0.80
IsActionMethod · 0.80

Tested by

no test coverage detected