Skip to content

chore: refresh eval results (#346) #127

chore: refresh eval results (#346)

chore: refresh eval results (#346) #127

name: Append gh-pages history
on:
push:
branches: [main]
paths:
- apps/web/src/data/eval-results.json
- apps/web/src/data/regression-eval-results.json
- apps/web/src/data/docs-eval-results.json
- apps/web/src/data/cli-eval-results.json
workflow_dispatch:
permissions:
contents: write
concurrency:
group: append-gh-pages-history
cancel-in-progress: false
jobs:
append:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9f698171ed81b15d1823a05fc7211befd50c8ae0 # v6.0.3
with:
fetch-depth: 0
- name: Append results to gh-pages
shell: bash
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin gh-pages:gh-pages
git checkout gh-pages
append_if_changed() {
local source="$1"
local history="$2"
if [ "${{ github.event_name }}" != "workflow_dispatch" ] && \
git diff --quiet "${{ github.event.before }}" "${{ github.sha }}" -- "$source"; then
return
fi
if ! git cat-file -e "${{ github.sha }}:$source" 2> /dev/null; then
return
fi
git show "${{ github.sha }}:$source" \
| jq -c --arg ts "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" --arg sha "${{ github.sha }}" \
'{ts: $ts, sha: $sha, results: .}' \
>> "$history"
}
append_if_changed apps/web/src/data/eval-results.json results.jsonl
append_if_changed apps/web/src/data/regression-eval-results.json regression-results.jsonl
append_if_changed apps/web/src/data/docs-eval-results.json docs-results.jsonl
append_if_changed apps/web/src/data/cli-eval-results.json cli-results.jsonl
for history in results.jsonl regression-results.jsonl docs-results.jsonl cli-results.jsonl; do
[ -f "$history" ] && git add "$history"
done
if git diff --cached --quiet; then
echo "No result history changes to commit"
exit 0
fi
git commit -m "chore: append eval results"
git push origin gh-pages
git checkout -