Repository navigation
53 lines (48 loc) · 1.86 KB
/
Copy pathsync-crawler-config.yml
File metadata and controls
53 lines (48 loc) · 1.86 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Sync Algolia crawler config
# Pushes algolia/crawler-config.js to the Algolia Crawler and triggers a
# reindex, so the versioned config is the source of truth and no manual
# dashboard editing is needed.
#
# Runs only when the config (or this sync script) changes on main, plus a
# manual trigger. Content-only publishes are handled by algolia-reindex.yml
# instead, so the two never double-crawl.
#
# Requires (repo Settings -> Secrets and variables -> Actions):
# - Variable ALGOLIA_CRAWLER_ID
# - Secret ALGOLIA_CRAWLER_USER_ID
# - Secret ALGOLIA_CRAWLER_API_KEY
# - Secret ALGOLIA_ADMIN_API_KEY (optional — needed to push
# initialIndexSettings to existing indices, since the crawler
# only applies them on index creation)
on:
push:
branches: [main]
paths:
- algolia/crawler-config.js
- scripts/sync-crawler-config.ts
workflow_dispatch:
concurrency:
group: algolia-sync-config
cancel-in-progress: true
permissions:
contents: read
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Sync config and trigger reindex
env:
ALGOLIA_CRAWLER_ID: ${{ vars.ALGOLIA_CRAWLER_ID }}
ALGOLIA_CRAWLER_USER_ID: ${{ secrets.ALGOLIA_CRAWLER_USER_ID }}
ALGOLIA_CRAWLER_API_KEY: ${{ secrets.ALGOLIA_CRAWLER_API_KEY }}
ALGOLIA_ADMIN_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
# On push, skip the reindex here — algolia-reindex.yml fires after the
# Vercel production deploy so pages are live before the crawl starts.
# On workflow_dispatch there is no pending deploy, so reindex immediately.
SKIP_REINDEX: ${{ github.event_name == 'push' }}
run: pnpm sync-crawler-config