@@ -78,112 +78,112 @@ outputs:
7878runs :
7979 using : ' composite'
8080 steps :
81- - name : Verify GitHub Auth
82- shell : bash
83- run : gh auth status
84- env :
85- GH_TOKEN : ${{ inputs.copilot-token }}
8681 - uses : actions/setup-node@v6
8782 with :
8883 node-version : ' 22'
89- - name : Install GitHub Copilot CLI
84+ - name : Run GitHub Copilot CLI
85+ id : copilot
86+ shell : bash
9087 run : |
88+ echo "::group::Verify GitHub Auth"
89+ gh auth status
90+ echo "::endgroup::"
91+
92+ echo "::group::Install GitHub Copilot CLI"
9193 if [ "$COPILOT_VERSION" = "latest" ]; then
9294 npm install -g @github/copilot
9395 else
9496 npm install -g @github/copilot@$COPILOT_VERSION
9597 fi
98+ echo "::endgroup::"
99+
96100 copilot --version || echo "Warning: Could not get copilot version"
97- shell : bash
98- env :
99- COPILOT_VERSION : ${{ inputs.copilot-version }}
100- - name : Configure Copilot MCP
101- if : inputs.mcp-config
102- shell : bash
103- run : |
104- cat $XDG_CONFIG_HOME/.copilot/mcp-config.json || echo "No existing MCP config found"
105- mkdir -p $XDG_CONFIG_HOME/.copilot
106101
107- # Create base MCP config with GitHub MCP server (comes pre-configured by default)
108- BASE_MCP_CONFIG='{
109- "mcpServers": { }
110- }'
102+ echo "::group::Configure Copilot MCP"
103+ if [ -n "$MCP_CONFIG" ]; then
104+ cat $XDG_CONFIG_HOME/.copilot/mcp-config.json || echo "No existing MCP config found"
105+ mkdir -p $XDG_CONFIG_HOME/.copilot
106+
107+ BASE_MCP_CONFIG='{
108+ "mcpServers": { }
109+ }'
111110
112- # Merge user-provided MCP config with base config
113- MERGED_MCP_CONFIG=$(echo "$BASE_MCP_CONFIG" | jq --argjson user "$MCP_CONFIG" '.mcpServers += $user.mcpServers')
114- echo "$MERGED_MCP_CONFIG" > $XDG_CONFIG_HOME/.copilot/mcp-config.json
115- cat $XDG_CONFIG_HOME/.copilot/mcp-config.json
116- env :
117- CONFIG : ${{ inputs.copilot-config }}
118- MCP_CONFIG : ${{ inputs.mcp-config }}
119- - name : Build Copilot Args
120- shell : bash
121- run : |
111+ MERGED_MCP_CONFIG=$(echo "$BASE_MCP_CONFIG" | jq --argjson user "$MCP_CONFIG" '.mcpServers += $user.mcpServers')
112+ echo "$MERGED_MCP_CONFIG" > $XDG_CONFIG_HOME/.copilot/mcp-config.json
113+ cat $XDG_CONFIG_HOME/.copilot/mcp-config.json
114+ fi
115+ echo "::endgroup::"
116+
117+ echo "::group::Build Copilot Args"
122118 COPILOT_ARGS=""
123119
124120 COPILOT_ARGS+="--add-dir / "
125-
126121 if [ -n "$ADDITIONAL_DIRS" ]; then
127122 IFS=',' read -ra DIRS <<< "$ADDITIONAL_DIRS"
128123 for dir in "${DIRS[@]}"; do
129124 COPILOT_ARGS+="--add-dir $dir "
130125 done
131126 fi
132-
133127 if [ -n "$DISABLE_MCP_SERVERS" ]; then
134128 IFS=',' read -ra SERVERS <<< "$DISABLE_MCP_SERVERS"
135129 for server in "${SERVERS[@]}"; do
136130 COPILOT_ARGS+="--disable-mcp-server $server "
137131 done
138132 fi
139-
140133 if [ "$ENABLE_ALL_GITHUB_MCP_TOOLS" = "true" ]; then
141134 COPILOT_ARGS+="--enable-all-github-mcp-tools "
142135 fi
143-
144136 if [ "$ALLOW_ALL_TOOLS" = "true" ]; then
145137 COPILOT_ARGS+="--allow-all-tools "
146138 fi
147-
148139 if [ -n "$ALLOWED_TOOLS" ]; then
149140 IFS=',' read -ra TOOLS <<< "$ALLOWED_TOOLS"
150141 for tool in "${TOOLS[@]}"; do
151142 COPILOT_ARGS+="--allow-tool $tool "
152143 done
153144 fi
154-
155145 if [ -n "$DENIED_TOOLS" ]; then
156146 IFS=',' read -ra TOOLS <<< "$DENIED_TOOLS"
157147 for tool in "${TOOLS[@]}"; do
158148 COPILOT_ARGS+="--deny-tool $tool "
159149 done
160150 fi
161-
162151 if [ -n "$MODEL" ]; then
163152 COPILOT_ARGS+="--model $MODEL "
164153 fi
165-
166154 if [ -n "$AGENT" ]; then
167155 COPILOT_ARGS+="--agent $AGENT "
168156 fi
169-
170157 if [ -n "$RESUME_SESSION" ]; then
171158 if [ "$RESUME_SESSION" = "latest" ]; then
172159 COPILOT_ARGS+="--continue "
173160 else
174161 COPILOT_ARGS+="--resume $RESUME_SESSION "
175162 fi
176163 fi
177-
178164 if [ -n "$LOG_LEVEL" ]; then
179165 COPILOT_ARGS+="--log-level $LOG_LEVEL "
180166 fi
181167 COPILOT_ARGS+="--log-dir $HOME/.copilot/logs"
182-
168+
183169 echo "$COPILOT_ARGS"
184-
185- echo "COPILOT_ARGS=$COPILOT_ARGS" >> "$GITHUB_ENV"
170+ echo "::endgroup::"
171+
172+ echo "::group::Run Copilot CLI"
173+ set +e
174+ copilot -p "$PROMPT" $COPILOT_ARGS
175+ EXIT_CODE=$?
176+ echo "::endgroup::"
177+
178+ echo "logs_path=$HOME/.copilot/logs" >> $GITHUB_OUTPUT
179+ echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT
186180 env :
181+ GH_TOKEN : ${{ inputs.repo-token || inputs.copilot-token }}
182+ COPILOT_GITHUB_TOKEN : ${{ inputs.copilot-token }}
183+ PROMPT : ${{ inputs.prompt }}
184+ COPILOT_VERSION : ${{ inputs.copilot-version }}
185+ CONFIG : ${{ inputs.copilot-config }}
186+ MCP_CONFIG : ${{ inputs.mcp-config }}
187187 ALLOW_ALL_TOOLS : ${{ inputs.allow-all-tools }}
188188 ALLOWED_TOOLS : ${{ inputs.allowed-tools }}
189189 DENIED_TOOLS : ${{ inputs.denied-tools }}
@@ -194,22 +194,6 @@ runs:
194194 ENABLE_ALL_GITHUB_MCP_TOOLS : ${{ inputs.enable-all-github-mcp-tools }}
195195 RESUME_SESSION : ${{ inputs.resume-session }}
196196 LOG_LEVEL : ${{ inputs.log-level }}
197- - name : Run Copilot CLI
198- id : copilot
199- shell : bash
200- run : |
201- set +e
202-
203- copilot -p "$PROMPT" $COPILOT_ARGS
204- EXIT_CODE=$?
205-
206- # Set outputs
207- echo "logs_path=$HOME/.copilot/logs" >> $GITHUB_OUTPUT
208- echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT
209- env :
210- GH_TOKEN : ${{ inputs.repo-token || inputs.copilot-token }}
211- COPILOT_GITHUB_TOKEN : ${{ inputs.copilot-token }}
212- PROMPT : ${{ inputs.prompt }}
213197 - name : Upload Copilot Artifacts
214198 uses : actions/upload-artifact@v4
215199 if : ${{ always() && inputs.upload-artifact == 'true' }}
0 commit comments