Skip to content

Merge pull request #12 from cheginit/pre-commit-ci-update-config #69

Merge pull request #12 from cheginit/pre-commit-ci-update-config

Merge pull request #12 from cheginit/pre-commit-ci-update-config #69

Workflow file for this run

name: Build and Update README
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
fetch-depth: 0
path: main
- name: Checkout til-db
uses: actions/checkout@v4
with:
repository: cheginit/til-db
path: til-db
token: ${{ secrets.DB_PUSH }}
- name: Create a Python environment
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: pip
- name: Install Python dependencies
run: |
pip install -r main/requirements.txt
- name: Build database
run: |-
cd main
python build_database.py
- name: Update README
run: |-
cd main
python update_readme.py --rewrite
cat README.md
- name: Commit and push if READMEs changed
run: |-
cd main
git config --global user.email "github-actions@github.com"
git config --global user.name "github-actions"
git diff --quiet HEAD $REF -- $DIR || (git add README.md && git commit -m "GHW: Updated READMEs [skip ci]")
git push
- name: Save tils.db to cheginit/til-db
run: |-
cd til-db
cp ../main/tils.db .
git add tils.db
git commit --amend --no-edit
git push --force