run zotero-to-html.py #69
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: run zotero-to-html.py | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- 'bibliography.html' | |
- 'README.md' | |
schedule: | |
- cron: '0 3 * * *' # Daily at 03:00 | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repo content | |
uses: actions/checkout@v4 # checkout the repository content | |
- name: setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.13' # use latest python version | |
- name: install python packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: execute py script | |
run: python zotero-to-html.py | |
- name: check for changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "Babalion" | |
git diff --exit-code bibliography.html || echo "Changes detected" | |
# Step 6: Commit and push changes (if any) | |
- name: Commit and push changes | |
if: success() # Ensure the script runs successfully | |
run: | | |
git add bibliography.html | |
git commit -m "Update bibliography.html via GitHub Actions" || echo "No changes to commit" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub's built-in token for auth |