Skip to content

Commit 2ab5f1d

Browse files
authored
Update test-responses-basic-aoai-v1.yml
1 parent 353c2aa commit 2ab5f1d

1 file changed

Lines changed: 28 additions & 27 deletions

File tree

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

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,32 @@ on:
55

66
jobs:
77
run-validation:
8+
name: Run AOAI basic response validation
89
runs-on: ubuntu-latest
910
environment: responses
1011

1112
env:
12-
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
13+
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
1314
AZURE_OPENAI_V1_API_ENDPOINT: ${{ secrets.AZURE_OPENAI_V1_API_ENDPOINT }}
14-
AZURE_OPENAI_API_MODEL: ${{ secrets.AZURE_OPENAI_API_MODEL }}
15+
AZURE_OPENAI_API_MODEL: ${{ secrets.AZURE_OPENAI_API_MODEL }}
1516

1617
steps:
17-
# 1 – check out the repo so the script is available
18-
- name: Checkout repository
18+
- name: 📥 Checkout repository
1919
uses: actions/checkout@v4
2020

21-
# 2 – set up Python
22-
- name: Setup Python 3.11
21+
- name: 🐍 Set up Python 3.11
2322
uses: actions/setup-python@v5
2423
with:
2524
python-version: '3.11'
2625

27-
# 3 – install the script’s two lightweight deps
28-
- name: Install requirements
26+
- name: 📦 Install requirements
2927
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y jq
3030
python -m pip install --upgrade pip
31-
pip install openai python-dotenv jq
31+
pip install openai python-dotenv
3232
33-
# 4 – run the script, grade the result, assemble a report
34-
- name: Execute script and capture outcome
33+
- name: ▶️ Execute script and capture outcome
3534
id: test
3635
shell: bash
3736
run: |
@@ -49,33 +48,33 @@ jobs:
4948
5049
jq -n \
5150
--arg date "$TIMESTAMP" \
52-
--arg output "$(tr -d '\r' < out.txt)" \
51+
--arg output "$(cat out.txt | tr -d '\r')" \
5352
--arg pass_fail "$PASS_FAIL" \
5453
--argjson code "$EXIT_CODE" \
5554
'{test_run_date: $date,
56-
output: $output,
57-
pass_fail: $pass_fail,
58-
error_code: $code}' \
59-
> aoai-test-result.json
55+
output: $output,
56+
pass_fail: $pass_fail,
57+
error_code: $code}' \
58+
> aoai-test-result.json
6059
61-
# 5 – make the report downloadable from the run summary
62-
- name: Upload result artifact
60+
- name: 📤 Upload result artifact
61+
if: always()
6362
uses: actions/upload-artifact@v4
6463
with:
6564
name: aoai-response-test
6665
path: aoai-test-result.json
6766

68-
# 6 – parse JSON and inject into README
69-
- name: Parse results and update README
67+
- name: 📝 Parse results and update README
68+
if: always()
7069
shell: bash
7170
env:
7271
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7372
run: |
74-
PASS=$(jq -r .pass_fail aoai-test-result.json)
75-
CODE=$(jq -r .error_code aoai-test-result.json)
76-
DATE=$(jq -r .test_run_date aoai-test-result.json)
73+
PASS=$(jq -r .pass_fail aoai-test-result.json)
74+
CODE=$(jq -r .error_code aoai-test-result.json)
75+
DATE=$(jq -r .test_run_date aoai-test-result.json)
7776
78-
read -r -d '' SNIPPET << 'EOF'
77+
read -r -d '' SNIPPET <<EOF
7978
<!-- AOAI-RESULTS-START -->
8079
## ⚙️ Last Azure OpenAI Test
8180
- **Date:** $DATE
@@ -91,11 +90,13 @@ jobs:
9190
{ print }
9291
' README.md > README.tmp && mv README.tmp README.md
9392
94-
# 7 – commit & push the updated README back
95-
- name: Commit updated README
93+
- name: 🔀 Commit updated README
94+
if: >
95+
github.event_name == 'workflow_dispatch' &&
96+
github.actor != 'github-actions[bot]'
9697
uses: stefanzweifel/git-auto-commit-action@v4
9798
with:
98-
commit_message: chore: update README with latest AOAI test results
99+
commit_message: 'chore: update README with latest AOAI test results'
99100
file_pattern: README.md
100101
author_name: GitHub Actions
101102
author_email: actions@github.com

0 commit comments

Comments
 (0)