Take screenshots #221
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: Take screenshots | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: '05 3 * * *' | |
permissions: | |
contents: write | |
jobs: | |
shot-scraper: | |
runs-on: ubuntu-latest | |
if: ${{ github.repository != 'simonw/shot-scraper-template' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- 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: Cache Playwright browsers | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/ms-playwright/ | |
key: ${{ runner.os }}-browsers | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
- name: Install Playwright dependencies | |
run: | | |
shot-scraper install | |
- name: Take shots | |
run: | | |
python get_pages.py | |
- name: Commit and push | |
run: |- | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "${timestamp}" || exit 0 | |
git pull --rebase | |
git push |