@@ -109,6 +109,10 @@ inputs:
109109 description : ' Share session to a secret GitHub gist after completion'
110110 required : false
111111 default : false
112+ fail-on-error :
113+ description : ' Fail the step if the Copilot CLI exits with a non-zero exit code'
114+ required : false
115+ default : false
112116 log-level :
113117 description : ' Set the log level (choices: "none", "error", "warning", "info", "debug", "all", "default")'
114118 required : false
@@ -124,6 +128,9 @@ outputs:
124128 exit-code :
125129 description : ' Exit code from the Copilot CLI command'
126130 value : ${{ steps.copilot.outputs.exit_code }}
131+ session-path :
132+ description : ' Path to the shared session markdown file (if share was used)'
133+ value : ${{ steps.copilot.outputs.session_path }}
127134runs :
128135 using : ' composite'
129136 steps :
@@ -139,6 +146,14 @@ runs:
139146 echo "::group::Copilot CLI Version"
140147 echo "CLI Version: $(copilot --version)"
141148 echo "::endgroup::"
149+
150+ if [ -n "$CONFIG" ]; then
151+ echo "::group::Configure Copilot"
152+ mkdir -p $HOME/.copilot
153+ echo "$CONFIG" > $HOME/.copilot/config.json
154+ cat $HOME/.copilot/config.json
155+ echo "::endgroup::"
156+ fi
142157
143158 if [ -n "$MCP_CONFIG" ]; then
144159 echo "::group::Configure Copilot MCP"
@@ -283,6 +298,17 @@ runs:
283298
284299 echo "logs_path=$HOME/.copilot/logs" >> $GITHUB_OUTPUT
285300 echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT
301+
302+ # Capture session share path if it exists
303+ SESSION_FILE=$(ls copilot-session-*.md 2>/dev/null | head -1)
304+ if [ -n "$SESSION_FILE" ]; then
305+ echo "session_path=$SESSION_FILE" >> $GITHUB_OUTPUT
306+ fi
307+
308+ if [ "$FAIL_ON_ERROR" = "true" ] && [ "$EXIT_CODE" -ne 0 ]; then
309+ echo "::error::Copilot CLI exited with code $EXIT_CODE"
310+ exit $EXIT_CODE
311+ fi
286312 env :
287313 GITHUB_TOKEN : ${{ inputs.copilot-token }}
288314 GH_TOKEN : ${{ inputs.copilot-token }}
@@ -313,6 +339,7 @@ runs:
313339 DISABLE_BUILTIN_MCPS : ${{ inputs.disable-builtin-mcps }}
314340 ADD_GITHUB_MCP_TOOLS : ${{ inputs.add-github-mcp-tools }}
315341 ADD_GITHUB_MCP_TOOLSETS : ${{ inputs.add-github-mcp-toolsets }}
342+ FAIL_ON_ERROR : ${{ inputs.fail-on-error }}
316343 EXTRA_ARGS : ${{ inputs.options }}
317344 - name : Upload Copilot Artifacts
318345 uses : actions/upload-artifact@v4
@@ -321,4 +348,5 @@ runs:
321348 name : copilot-logs-${{ github.job }}-${{ github.run_id }}-${{ github.run_attempt }}
322349 path : |
323350 ~/.copilot/logs
351+ copilot-session-*.md
324352 if-no-files-found : warn
0 commit comments