Skip to content

GitHub action to retrieve Zotero collection in BibLaTeX format and save it as GitHub repository #2105

GitHub action to retrieve Zotero collection in BibLaTeX format and save it as GitHub repository

GitHub action to retrieve Zotero collection in BibLaTeX format and save it as GitHub repository #2105

name: GitHub action to retrieve Zotero collection in BibLaTeX format and save it as GitHub repository
on:
schedule:
- cron: "0 8,12,18 * * *"
push:
branches:
- test
workflow_dispatch:
env:
PYTHON_VERSION: "3.12"
POETRY_VERSION: "1.7.0"
POETRY_URL: https://install.python-poetry.org
jobs:
zotero-bib-to-gh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
id: setup_python
- name: Cache Poetry cache
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}
- name: Cache Packages
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-local-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }}
- name: Install Poetry ${{ env.POETRY_VERSION }}
run: |
curl -sSL ${{ env.POETRY_URL }} | python - --version ${{ env.POETRY_VERSION }}
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install Dependencies
run: poetry install
- name: Run
run: poetry run python zotero-bib-to-gh.py
env:
ZOTERO_USER_ID: ${{ secrets.ZOTERO_USER_ID }}
ZOTERO_BEARER_TOKEN: ${{ secrets.ZOTERO_BEARER_TOKEN }}
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
echo `git add -A && git commit -m "Add changes"`
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}