Update README Performance #348
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: Update README Performance | |
| on: | |
| workflow_run: | |
| workflows: ["Performance Benchmarks"] | |
| types: | |
| - completed | |
| branches: | |
| - main | |
| jobs: | |
| update-readme: | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: write | |
| actions: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| ref: main | |
| - name: Download benchmark artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: benchmark-results-${{ github.event.workflow_run.head_sha }} | |
| path: ./benchmark-results | |
| run-id: ${{ github.event.workflow_run.id }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Update README with performance metrics | |
| run: | | |
| if [ -d "./benchmark-results" ] && [ "$(ls -A ./benchmark-results/*.json 2>/dev/null)" ]; then | |
| python3 scripts/update_readme_performance.py \ | |
| --benchmark-results ./benchmark-results \ | |
| --readme README.md \ | |
| --output README.md | |
| else | |
| echo "No benchmark results found, skipping README update" | |
| exit 0 | |
| fi | |
| - name: Check for changes | |
| id: check_changes | |
| run: | | |
| git diff --quiet README.md || echo "changed=true" >> $GITHUB_OUTPUT | |
| - name: Commit updated README | |
| if: steps.check_changes.outputs.changed == 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add README.md | |
| git commit -m "docs: update performance metrics in README [skip ci]" | |
| git push |