mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## Problem We need embeddings for Kb to run a search endpoint in the Content API and future KB search. ## Solution This PR adds KB search backed by its own Supabase table, ingested from the KB markdown export, and aligns the KB and docs search ingest setups. <!-- ## Preview links If relevant, include links to changed pages for easy review access. Copy the preview base URL from the Vercel bot comment on this PR. Use the following table as an example template. | Site | Live | Preview | Search for | | -------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------- | | WWW | [/blog/your-post](https://supabase.com/blog/your-post) | [/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post) | unique phrase from the change | | Docs | [/docs/guides/your-page](https://supabase.com/docs/guides/your-page) | [/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page) | unique phrase from the change | | Studio | [/dashboard](https://supabase.com/dashboard) | [/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard) | unique phrase from the change | | Design system | [/design-system](https://supabase.com/design-system) | [/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system) | unique phrase from the change | | UI library | [/library](https://supabase.com/library) | [/library](https://ui-library-git-branch-name-supabase.vercel.app/library) | unique phrase from the change | | Knowledge base | [/kb/guides/your-page](https://supabase.com/kb/guides/your-page) | [/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page) | unique phrase from the change | --> <!-- ## Additional context Optionally add any other context or screenshots. --> ## Test 1. Run the **KB Search Ingest** workflow, or locally run `pnpm --filter kb search:ingest` with `SUPABASE_URL` and `SUPABASE_SERVICE_ROLE_KEY` set in `apps/kb/.env.local`. 2. Query the endpoint and check that the results link to `https://supabase.com/kb/troubleshooting/...`: ``` curl '<kb-url>/kb/api/search?q=connect%20timeout&limit=5' ``` ## Checklist Check all before review: - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [x] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) --------- Co-authored-by: Jeremias Menichelli <jmenichelli@gmail.com>
143 lines
4.7 KiB
YAML
143 lines
4.7 KiB
YAML
name: Docs Tests
|
|
|
|
on:
|
|
pull_request:
|
|
branches: ['master']
|
|
paths:
|
|
- 'apps/docs/**/*.ts*'
|
|
- 'apps/docs/spec/**/*.json'
|
|
- 'apps/docs/spec/Makefile'
|
|
- 'apps/docs/spec/sections/generateAccessControlPartials.mts'
|
|
- 'apps/docs/content/_partials/access-control/**'
|
|
- 'apps/docs/.env.development'
|
|
- 'apps/docs/package.json'
|
|
- 'packages/docs-search/**'
|
|
- 'packages/shared-data/package.json'
|
|
- 'packages/shared-data/scoped-access-token-permissions.ts'
|
|
- 'e2e/docs/local-smoke/**'
|
|
- 'e2e/docs/playwright.local-smoke.config.ts'
|
|
- 'e2e/docs/package.json'
|
|
- '.github/workflows/docs-tests.yml'
|
|
|
|
# Cancel old builds on new commit for same workflow + branch/PR
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
CI: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
persist-credentials: false
|
|
sparse-checkout: |
|
|
apps/docs
|
|
examples
|
|
packages
|
|
supabase
|
|
patches
|
|
|
|
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
|
|
name: Install pnpm
|
|
with:
|
|
run_install: false
|
|
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install deps
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
# Independent prep: a codegen diff check, a download, and a local codegen.
|
|
- parallel:
|
|
- name: Check access-control partials
|
|
run: |
|
|
make -C apps/docs/spec generate.partials.access-control
|
|
git diff --exit-code -- \
|
|
apps/docs/content/_partials/access-control/scoped_pat_permissions.mdx \
|
|
apps/docs/content/_partials/access-control/scoped_pat_mcp_tools.mdx
|
|
|
|
- name: Download JS reference TypeDoc dumps
|
|
# The source dumps under apps/docs/spec/reference/<lib>/<ver>/*.json are
|
|
# gitignored — `make download.tsdoc.v2` re-fetches them from
|
|
# supabase.github.io so the reference-content snapshot test has
|
|
# something to walk.
|
|
working-directory: apps/docs/spec
|
|
run: make download.tsdoc.v2
|
|
|
|
- name: Generate Dart reference dump
|
|
# Dart has no upstream TypeDoc dump; its gitignored dump is generated
|
|
# from the committed `supabase_dart_v2.yml` so the reference-content
|
|
# snapshot test has something to walk.
|
|
working-directory: apps/docs
|
|
run: pnpm run codegen:references:dart
|
|
|
|
- name: Run tests
|
|
run: |
|
|
touch .env
|
|
# Needed to prevent local Supabase startup from erroring, due to
|
|
# GitHub Auth being enabled in config
|
|
echo "GITHUB_CLIENT_ID=dummy-id" >> .env
|
|
echo "GITHUB_SECRET=dummy-secret" >> .env
|
|
pnpm run test:docs
|
|
|
|
local-dev-smoke:
|
|
name: Local dev smoke (no credentials)
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
persist-credentials: false
|
|
sparse-checkout: |
|
|
apps/docs
|
|
examples
|
|
packages
|
|
supabase
|
|
patches
|
|
e2e/docs
|
|
|
|
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
|
|
name: Install pnpm
|
|
with:
|
|
run_install: false
|
|
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install deps
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Install Playwright Chromium
|
|
run: pnpm -C e2e/docs exec playwright install chromium --with-deps --only-shell
|
|
|
|
# Deliberately does not set DOCS_GITHUB_APP_*, SUPABASE_SECRET_KEY,
|
|
# OPENAI_API_KEY, or DOCS_REVALIDATION_KEYS — their absence here is what
|
|
# verifies `pnpm run dev:docs` still works without private credentials.
|
|
- name: Run local dev smoke tests
|
|
run: pnpm run e2e:docs:local-smoke
|
|
|
|
- name: Upload Playwright report
|
|
if: failure()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: docs-local-smoke-playwright-report
|
|
path: |
|
|
e2e/docs/playwright-report-local-smoke/
|
|
e2e/docs/test-results/
|
|
retention-days: 7
|