scrape #59
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: scrape | |
| on: | |
| workflow_dispatch: | |
| push: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| permissions: | |
| contents: write | |
| jobs: | |
| run: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: true | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run scraper | |
| env: | |
| PYTHONUNBUFFERED: '1' | |
| run: python scrape_ollama.py | |
| - name: Commit and push changes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Configure git user | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| # Ensure remote uses GITHUB_TOKEN | |
| git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git | |
| # Stage changes | |
| git add -A | |
| # Commit and push if there are changes | |
| if ! git diff --cached --quiet; then | |
| git commit -m "✨ Data update at $(date -u '+%Y-%m-%d')" | |
| git push origin HEAD:${{ github.ref_name }} | |
| else | |
| echo "No changes to commit" | |
| fi |