Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/algolia-index.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Algolia index

# Rebuilds the `sourcegraph_docs` Algolia index from the docs content whenever
# main changes. Records carry a `product` facet derived from
# src/data/navigation.ts, which the search modal uses for grouping, filter
# chips (see dev/algolia-index.mjs and src/data/search.ts).
#
# Needs the ALGOLIA_ADMIN_API_KEY repository secret: an Algolia API key for app
# JSZOJ0ZYVG with addObject, deleteObject, deleteIndex, settings, editSettings
# and browse ACLs, restricted to indices `sourcegraph_docs*`.

on:
push:
branches: [main]
paths:
- 'docs/**'
- 'src/data/navigation.ts'
- 'contentlayer.config.ts'
- 'dev/algolia-index.mjs'
- '.github/workflows/algolia-index.yml'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: algolia-index
cancel-in-progress: true

jobs:
index:
name: Build and push index
runs-on: ubuntu-latest
steps:
- name: Check out main
uses: actions/checkout@v4

- name: Set up pnpm
uses: pnpm/action-setup@v4

# Node 24 is pre-cached on ubuntu-latest.
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

# The indexer reads .contentlayer/generated, so build it first.
- name: Build contentlayer
run: pnpm exec contentlayer2 build

- name: Build records (dry run, prints per-product counts)
run: node dev/algolia-index.mjs --dry-run --stats

- name: Push index
env:
ALGOLIA_ADMIN_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
run: node dev/algolia-index.mjs
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ next-env.d.ts
# search index file generated on build
/public/search.json

# Algolia records/settings generated by dev/algolia-index.mjs
/.algolia/

# IDEs
.idea

Expand Down
2 changes: 1 addition & 1 deletion cspell-allow-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dgjhfomjieaadpoljlnidmbgkdffpack
VXNlcjox

# Algolia application ID
0EBA2NRQU3
JSZOJ0ZYVG

# Base64-encoded GraphQL ID "SearchJob:1"
U2VhcmNoSm9iOjY5
Expand Down
Loading
Loading