Update PC Part Prices #40
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: Update PC Part Prices | |
| on: | |
| schedule: | |
| # Run daily at 2 AM UTC (adjust as needed) | |
| - cron: '0 2 * * *' | |
| workflow_dispatch: # Allow manual triggering | |
| inputs: | |
| debug: | |
| description: 'Enable debug logging' | |
| required: false | |
| default: false | |
| type: boolean | |
| jobs: | |
| update-prices: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run price scraper | |
| run: | | |
| python scraper.py | |
| env: | |
| DEBUG: ${{ inputs.debug && '1' || '' }} | |
| - name: Check for changes | |
| id: git-check | |
| run: | | |
| git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT | |
| - name: Commit and push changes | |
| if: steps.git-check.outputs.changes == 'true' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add . | |
| git commit -m "chore: update PC part prices [automated]" | |
| git push | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |