Add precommit autoupdater #295
This file contains 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: Build README | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
schedule: | |
- cron: "0 0 1 * *" | |
env: | |
API_TOKEN: ${{ secrets.API_TOKEN }} | |
jobs: | |
build_readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Build README | |
run: | | |
sudo rm -rf /usr/lib/python3/dist-packages/simplejson | |
pip install -r requirements.txt | |
cat doc/README_prelude.md > README.md | |
python3 lichess_ascii_tracker.py -r Bullet >> README.md | |
cat doc/README_epilogue.md >> README.md | |
- name: Push code | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
# Force add since README is on gitignore | |
git add -f README.md | |
# Prevent empty add to result in error | |
git diff-index --quiet HEAD || git commit -m "Updated README" | |
git push |