Skip to content

Update package index every 30 minutes #76902

Update package index every 30 minutes

Update package index every 30 minutes #76902

name: Update package index every 30 minutes
on:
schedule:
- cron: '*/30 * * * *'
jobs:
index:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: json
- name: Checkout
uses: actions/checkout@v2
- name: Cache Composer Vendor
uses: actions/cache@v1
with:
path: indexer/vendor/
key: ${{ runner.os }}-indexer-vendor-${{ hashFiles('indexer/composer.lock') }}
restore-keys: ${{ runner.os }}-indexer-vendor-
- name: Install the dependencies
run: cd indexer && composer install --no-interaction --no-suggest
# Update statistics twice a day (24 * 30 mins = 12h)
- name: with-stats
run: |
echo "with_stats=$(expr ${{ github.run_number }} % 24)" >> $GITHUB_ENV
- name: Update Index
run: indexer/index -v ${{ env.with_stats == 0 && '--with-stats' || '' }}
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
ALGOLIA_INDEX: v3_packages