Skip to content

Commit 404a51b

Browse files
committed
enhanced error handling
1 parent bcb740b commit 404a51b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

action.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,27 @@ runs:
103103
fi
104104
105105
echo "executing: $STACKQL_DEPLOY_CMD $ENV_OPTS"
106+
107+
# Run command and capture exit code
108+
set +e
106109
$STACKQL_DEPLOY_CMD $ENV_OPTS
110+
EXIT_CODE=$?
111+
set -e
112+
113+
# Handle failure
114+
if [ $EXIT_CODE -ne 0 ]; then
115+
echo "## ❌ StackQL Deploy ${{ inputs.command }} Failed" >> $GITHUB_STEP_SUMMARY
116+
echo "" >> $GITHUB_STEP_SUMMARY
117+
echo "**Environment:** ${{ inputs.stack_env }}" >> $GITHUB_STEP_SUMMARY
118+
echo "**Stack Directory:** ${{ inputs.stack_dir }}" >> $GITHUB_STEP_SUMMARY
119+
echo "" >> $GITHUB_STEP_SUMMARY
120+
echo "Please check the logs above for details." >> $GITHUB_STEP_SUMMARY
121+
echo "" >> $GITHUB_STEP_SUMMARY
122+
echo "_Failed at $(date -u +'%Y-%m-%d %H:%M:%S UTC')_" >> $GITHUB_STEP_SUMMARY
123+
exit $EXIT_CODE
124+
fi
107125
108-
# Capture outputs if output file was specified
126+
# Capture outputs if output file was specified (success path)
109127
if [ -n "$OUTPUT_FILE" ] && [ -f "$OUTPUT_FILE" ]; then
110128
# Read the JSON content
111129
DEPLOYMENT_OUTPUTS=$(cat "$OUTPUT_FILE")

0 commit comments

Comments
 (0)