-
-
Notifications
You must be signed in to change notification settings - Fork 104
40 lines (33 loc) · 1.31 KB
/
index-scheduled.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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