Skip to content

Take screenshots

Take screenshots #86

Workflow file for this run

name: Take screenshots
on:
workflow_dispatch:
schedule:
- cron: "0 3 * * 1" # At 03:00 UTC on Monday: https://crontab.guru/#0_3_*_*_1
permissions:
contents: write
jobs:
take-shots:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache Oxipng
uses: actions/cache@v3
with:
path: ~/.cargo/
key: ${{ runner.os }}-cargo
- name: Install Oxipng if it is not installed
run: |
which oxipng || cargo install oxipng
- 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
- name: Cache Playwright browsers
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright/
key: ${{ runner.os }}-playwright
- name: Install dependencies
run: |
pip install shot-scraper
shot-scraper install
- name: Take shots
run: |
today=$(date +"%Y-%m-%d")
mkdir -p ./screenshots
shot-scraper https://hazadus.ru/ --width 1280 --wait 10000 -o "hazadus.ru.$today.png" || true
shot-scraper https://hazadus.ru/blogroll/ --width 1280 --wait 10000 -o "hazadus.ru-blogroll.$today.png" || true
shot-scraper http://hazadus.ru/microblog/ --width 1280 --wait 10000 -o "hazadus.ru-microblog.$today.png" || true
shot-scraper https://github.com/hazadus/ --width 1280 --wait 5000 -o "github-hazadus.$today.png" || true
shot-scraper https://steamcommunity.com/id/hazadus/ --width 1280 --wait 10000 -o "steam-profile.$today.png" || true
shot-scraper https://myshows.me/hazadus --width 1280 --wait 10000 --user-agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" -o "myshows.$today.png" || true
- name: Optimize PNGs
run: |-
oxipng -o 4 -i 0 --strip safe *.png && \
mv -f *.png ./screenshots/
- name: Commit and push
run: |-
git config user.name "Automated"
git config user.email "actions@users.noreply.github.com"
git add -A
timestamp=$(date -u)
git commit -m "Скриншоты от ${timestamp}" || exit 0
git pull --rebase
git push