Update stats #8295
This file contains 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 stats | |
on: | |
workflow_dispatch: | |
schedule: | |
# Runs every 3 hours (see https://crontab.guru) | |
- cron: "0 */3 * * *" | |
jobs: | |
update-stats: | |
name: Update stats | |
runs-on: ubuntu-latest | |
environment: stats | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- uses: actions/cache@v3 | |
name: Configure pip caching | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Get installed Playwright version | |
id: playwright-version | |
run: echo "PLAYWRIGHT_VERSION=1.40.0" >> $GITHUB_ENV | |
- name: Cache playwright binaries | |
uses: actions/cache@v3 | |
id: playwright-cache | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} | |
- run: pip install playwright==${{ env.PLAYWRIGHT_VERSION }} | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
- run: python -m playwright install | |
- name: Scrape new data values | |
run: ./scrape.py | |
- uses: EndBug/add-and-commit@v9 # You can change this to use a specific version. | |
with: | |
add: "." | |
author_name: "GitHub Actions" | |
message: "Scrape and update stats" | |
push: true |