Skip to content

cron

cron #8961

Workflow file for this run

name: cron
on:
schedule:
- cron: '0,30 * * * *'
workflow_dispatch:
concurrency:
group: cron-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
jobs:
deploy-v2:
name: Deploy scraper ^5.0
runs-on: ubuntu-24.04
steps:
- name: Setup PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1
with:
php-version: '8.4'
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install base dependencies (without scraper)
run: |
composer remove bvp/scraper --no-update || true
composer install --no-interaction --no-progress
- name: Require scraper version ^5.0
run: composer require bvp/scraper:^5.0 --no-update
- name: Update lock file for scraper
run: composer update bvp/scraper --with-dependencies
- name: Final install
run: composer install --prefer-dist --no-interaction --no-progress
- name: Scrape Data (v2)
run: php scraper.php v2
- name: Deploy JSON for scraper v2
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
FILES=$(
{
git ls-files -m -- 'docs/v2' | grep '\.json$'
git diff --cached --name-only --diff-filter=AM -- 'docs/v2' | grep '\.json$'
git ls-files --others --exclude-standard -- 'docs/v2' | grep '\.json$'
} | sort -u
)
if [ -n "$FILES" ]; then
git add $FILES
git commit -m "chore: deploy JSON files to docs/v2 [skip ci]" || exit 0
git pull --rebase --autostash
git push origin HEAD
else
echo "No JSON changes in docs/v2 to commit."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}