Skip to content

Commit 2b700b0

Browse files
Copilotguygregory
andcommitted
Enhance GitHub Action workflow with better error handling and validation
Co-authored-by: guygregory <16044916+guygregory@users.noreply.github.com>
1 parent 7f95ecf commit 2b700b0

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

.github/workflows/test-responses-basic-aoai-v1.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: actions/checkout@v4
1515

1616
- name: Set up Python
17-
uses: actions/setup-python@v4
17+
uses: actions/setup-python@v5
1818
with:
1919
python-version: '3.11'
2020

@@ -31,6 +31,23 @@ jobs:
3131
run: |
3232
echo "Testing responses-basic-aoai-v1.py script..."
3333
34+
# Verify required environment variables are set
35+
if [ -z "$AZURE_OPENAI_API_KEY" ] || [ -z "$AZURE_OPENAI_V1_API_ENDPOINT" ] || [ -z "$AZURE_OPENAI_API_MODEL" ]; then
36+
echo "❌ Error: Required environment variables are not set"
37+
echo "AZURE_OPENAI_API_KEY: ${AZURE_OPENAI_API_KEY:+set}"
38+
echo "AZURE_OPENAI_V1_API_ENDPOINT: ${AZURE_OPENAI_V1_API_ENDPOINT:+set}"
39+
echo "AZURE_OPENAI_API_MODEL: ${AZURE_OPENAI_API_MODEL:+set}"
40+
exit 1
41+
fi
42+
43+
# Verify jq is available
44+
if ! command -v jq > /dev/null; then
45+
echo "❌ Error: jq is not available"
46+
exit 1
47+
fi
48+
49+
echo "✅ Environment check passed"
50+
3451
# Create test results directory
3552
mkdir -p test-results
3653
@@ -39,6 +56,7 @@ jobs:
3956
echo "Test run timestamp: $timestamp"
4057
4158
# Run the script and capture output
59+
echo "Running Python script..."
4260
python responses-basic-aoai-v1.py > output.txt 2>&1
4361
exit_code=$?
4462
@@ -94,6 +112,16 @@ jobs:
94112
error_code: $error_code
95113
}' > test-results/test-results.json
96114
115+
# Also create a human-readable summary
116+
echo "Azure OpenAI Responses API Test Results" > test-results/test-summary.txt
117+
echo "========================================" >> test-results/test-summary.txt
118+
echo "Test Run Date: $timestamp" >> test-results/test-summary.txt
119+
echo "Result: $pass_fail" >> test-results/test-summary.txt
120+
echo "Error Code: $error_code" >> test-results/test-summary.txt
121+
echo "" >> test-results/test-summary.txt
122+
echo "Output:" >> test-results/test-summary.txt
123+
echo "$output_text" >> test-results/test-summary.txt
124+
97125
# Display final results
98126
echo "=== Test Results ==="
99127
echo "Timestamp: $timestamp"

0 commit comments

Comments
 (0)