Skip to content

Commit 1557dd5

Browse files
author
Augment Code
committed
Post eval results URL as PR comment
Signed-off-by: Lars Trieloff <lars@trieloff.net>
1 parent b985bad commit 1557dd5

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

.github/workflows/tessl-eval.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
pull_request:
55
branches: [main]
66

7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
711
jobs:
812
tessl-eval:
913
runs-on: ubuntu-latest
@@ -123,6 +127,7 @@ jobs:
123127
token: ${{ secrets.TESSL_TOKEN }}
124128

125129
- name: Run evals
130+
id: run-evals
126131
if: steps.trigger.outputs.skip != 'true' && steps.detect.outputs.skip != 'true'
127132
run: |
128133
PASS=0
@@ -131,7 +136,8 @@ jobs:
131136
ERRORS_FILE=$(mktemp)
132137
STDOUT_TMP=$(mktemp)
133138
STDERR_TMP=$(mktemp)
134-
trap 'rm -f "$SUMMARY_FILE" "$ERRORS_FILE" "$STDOUT_TMP" "$STDERR_TMP"' EXIT
139+
EVAL_URLS_FILE=$(mktemp)
140+
trap 'rm -f "$SUMMARY_FILE" "$ERRORS_FILE" "$STDOUT_TMP" "$STDERR_TMP" "$EVAL_URLS_FILE"' EXIT
135141
136142
POLL_INTERVAL=30
137143
TIMEOUT=900
@@ -164,6 +170,7 @@ jobs:
164170
fi
165171
166172
echo "Eval run started for $TILE_NAME with run ID: $RUN_ID"
173+
echo "- **$TILE_NAME**: [View results](https://tessl.io/eval-runs/$RUN_ID)" >> "$EVAL_URLS_FILE"
167174
168175
# Poll for completion
169176
ELAPSED=0
@@ -248,8 +255,32 @@ jobs:
248255
fi
249256
echo "============================="
250257
258+
# Export eval URLs for PR comment step
259+
if [ -s "$EVAL_URLS_FILE" ]; then
260+
echo "has_results=true" >> "$GITHUB_OUTPUT"
261+
{
262+
echo 'eval_urls<<EVAL_URLS_EOF'
263+
cat "$EVAL_URLS_FILE"
264+
echo 'EVAL_URLS_EOF'
265+
} >> "$GITHUB_OUTPUT"
266+
else
267+
echo "has_results=false" >> "$GITHUB_OUTPUT"
268+
fi
269+
251270
if [ "$FAIL" -gt 0 ]; then
252271
echo "::error::$FAIL tile(s) failed evaluation"
253272
exit 1
254273
fi
255274
275+
- name: Comment eval results on PR
276+
if: always() && github.event_name == 'pull_request' && steps.run-evals.outputs.has_results == 'true'
277+
env:
278+
GH_TOKEN: ${{ github.token }}
279+
run: |
280+
COMMENT="## Tessl Eval Results"
281+
COMMENT="$COMMENT"$'\n\n'
282+
COMMENT="$COMMENT${{ steps.run-evals.outputs.eval_urls }}"
283+
COMMENT="$COMMENT"$'\n\n'
284+
COMMENT="${COMMENT}_Triggered by commit $(git log -1 --format=%s)_"
285+
gh pr comment ${{ github.event.pull_request.number }} --body "$COMMENT"
286+

0 commit comments

Comments
 (0)