Update test-aoai-response.yml #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: 🧪 Run script & build report | ||
id: test | ||
env: | ||
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} | ||
AZURE_OPENAI_V1_API_ENDPOINT: ${{ secrets.AZURE_OPENAI_V1_API_ENDPOINT }} | ||
AZURE_OPENAI_API_MODEL: ${{ secrets.AZURE_OPENAI_API_MODEL }} | ||
run: | | ||
python - <<'PY' | ||
import datetime, json, pathlib, subprocess, sys | ||
# Execute your existing script and capture its stdout / exit code | ||
proc = subprocess.run( | ||
[sys.executable, "responses-basic-aoai-v1.py"], | ||
capture_output=True, text=True | ||
) | ||
output = proc.stdout.strip() | ||
error_code = proc.returncode | ||
passed = bool(output) and error_code == 0 # customise as needed | ||
result = { | ||
"run_timestamp_utc": datetime.datetime.utcnow() | ||
.isoformat(timespec="seconds") + "Z", | ||
"output": output, | ||
"pass": passed, | ||
"error_code": error_code, | ||
} | ||
pathlib.Path("aoai_test_result.json").write_text( | ||
json.dumps(result, indent=2), encoding="utf-8" | ||
) | ||
if not passed: | ||
sys.exit(error_code or 1) | ||
PY |