Skip to content

Commit 50cad47

Browse files
authored
Update test-responses-basic-aoai-v1.yml
1 parent 3ddd9b8 commit 50cad47

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,43 @@ jobs:
6565
with:
6666
name: aoai-response-test # folder name visible in the UI
6767
path: aoai-test-result.json
68+
69+
# 6 – parse JSON and inject into README
70+
- name: Parse results and update README
71+
shell: bash
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
run: |
75+
# read the values
76+
PASS=$(jq -r .pass_fail aoai-test-result.json)
77+
CODE=$(jq -r .error_code aoai-test-result.json)
78+
DATE=$(jq -r .test_run_date aoai-test-result.json)
79+
80+
# build the markdown snippet
81+
read -r -d '' SNIPPET << EOF
82+
<!-- AOAI-RESULTS-START -->
83+
## ⚙️ Last Azure OpenAI Test
84+
- **Date:** $DATE
85+
- **Result:** $PASS
86+
- **Exit code:** $CODE
87+
<!-- AOAI-RESULTS-END -->
88+
EOF
89+
90+
# replace the section between the markers in README.md
91+
# (assumes README.md already has those two markers somewhere)
92+
awk -v new="$SNIPPET" '
93+
/<!-- AOAI-RESULTS-START -->/ { print new; skip=1; next }
94+
/<!-- AOAI-RESULTS-END -->/ { print; skip=0; next }
95+
skip { next }
96+
{ print }
97+
' README.md > README.tmp && mv README.tmp README.md
98+
99+
# 7 – commit & push the updated README back
100+
- name: Commit updated README
101+
uses: stefanzweifel/git-auto-commit-action@v4
102+
with:
103+
commit_message: chore: update README with latest AOAI test results
104+
file_pattern: README.md
105+
author_name: GitHub Actions
106+
author_email: [email protected]
107+
branch: ${{ github.ref_name }}

0 commit comments

Comments
 (0)