Scholar Sync #43
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: Scholar Sync | |
| on: | |
| schedule: | |
| - cron: '17 2 * * *' | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install deps | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests pyyaml scholarly | |
| - name: Run sync | |
| env: | |
| SERPAPI_API_KEY: ${{ secrets.SERPAPI_API_KEY }} | |
| run: | | |
| python scripts/scholar_sync.py | |
| - name: Verify generated publications | |
| run: | | |
| if [ ! -d _publications/auto ]; then | |
| echo "_publications/auto directory not created." | |
| exit 1 | |
| fi | |
| ls -la _publications/auto || true | |
| COUNT=$(ls -1 _publications/auto/*.md 2>/dev/null | wc -l | tr -d ' ') | |
| echo "Generated $COUNT publication files" | |
| if [ "$COUNT" = "0" ]; then | |
| echo "No publications generated. Make sure SERPAPI_API_KEY is set, otherwise scholarly may be blocked in CI." | |
| exit 1 | |
| fi | |
| - name: Commit and push changes | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add _publications/auto/*.md || true | |
| git diff --cached --quiet || git commit -m "chore: sync publications from Google Scholar" | |
| git pull --rebase | |
| git push |