Skip to content

Update Publications from Google Scholar #2

Update Publications from Google Scholar

Update Publications from Google Scholar #2

name: Update Publications from Google Scholar
on:
schedule:
- cron: '0 0 * * 0' # Run every Sunday at midnight UTC
workflow_dispatch: # Allow manual trigger from GitHub UI
jobs:
update-publications:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
pip install scholarly pyyaml
- name: Debug Scholar ID
run: |
echo "Scholar ID is set: ${{ secrets.SCHOLAR_ID != '' }}"
echo "Scholar ID length: ${#SCHOLAR_ID}"
env:
SCHOLAR_ID: ${{ secrets.SCHOLAR_ID }}
- name: Update publications
run: |
echo "Starting publication update..."
python scripts/update_publications.py
echo "Script completed."
echo "Checking if publications.yml was created..."
if [ -f "_data/publications.yml" ]; then
echo "✅ publications.yml created successfully!"
echo "File size: $(wc -c < _data/publications.yml) bytes"
echo "Number of lines: $(wc -l < _data/publications.yml)"
echo "First few lines:"
head -10 _data/publications.yml
else
echo "❌ publications.yml was NOT created"
echo "Current directory contents:"
ls -la
echo "_data directory contents:"
ls -la _data/ || echo "_data directory does not exist"
fi
env:
SCHOLAR_ID: ${{ secrets.SCHOLAR_ID }}
- name: Check for changes
id: verify-changed-files
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Git status shows changes:"
git status --porcelain
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "No changes detected"
fi
- name: Commit and push changes
if: steps.verify-changed-files.outputs.changed == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add _data/publications.yml
git commit -m "🤖 Auto-update publications from Google Scholar"
git push