Run club rankings scraper #442
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
## Reference: https://github.com/MarketingPipeline/Python-Selenium-Action | |
name: Run club rankings scraper | |
on: | |
schedule: | |
- cron: '0 10 * * *' | |
workflow_dispatch: | |
jobs: | |
scrape: | |
runs-on: ubuntu-latest | |
env: | |
CLUB_RANKINGS_TOKEN: ${{ secrets.CLUB_RANKINGS_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
## https://github.com/marketplace/actions/install-poetry-action | |
## https://jacobian.org/til/github-actions-poetry/ | |
- name: Set up python | |
id: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Cache poetry install | |
id: cache-poetry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local | |
key: poetry-1.5.0 | |
- name: Install and configure Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.5.0 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Load cached venv | |
id: cache-poetry-deps | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cache-poetry-deps.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root | |
- name: Install project | |
run: poetry install --no-interaction | |
## Needs this because caching may create a mismatch for chromedriver_autoinstaller | |
- name: Remove previous chrome instances on runner | |
run: sudo apt purge google-chrome-stable | |
- name: Run script | |
run: | | |
poetry run python src/scrape.py | |