generateCopilotSetupStepsYAML generates the copilot-setup-steps.yml content based on action mode
(ctx context.Context, actionMode workflow.ActionMode, version string, resolver workflow.SHAResolver)
| 47 | |
| 48 | // generateCopilotSetupStepsYAML generates the copilot-setup-steps.yml content based on action mode |
| 49 | func 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 |
| 59 | on: |
| 60 | workflow_dispatch: |
| 61 | push: |
| 62 | paths: |
| 63 | - .github/workflows/copilot-setup-steps.yml |
| 64 | |
| 65 | jobs: |
| 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 |
| 89 | on: |
| 90 | workflow_dispatch: |
| 91 | push: |
| 92 | paths: |
| 93 | - .github/workflows/copilot-setup-steps.yml |
| 94 | |
| 95 | jobs: |
| 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 |
no test coverage detected