The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(embeddings): github app auth
Greg Richardsonef2753cab211
diff --git a/apps/docs/.env.example b/apps/docs/.env.exampleindex 7fa24758cb1..81e97461ea0 100644--- a/apps/docs/.env.example+++ b/apps/docs/.env.example@@ -5,6 +5,9 @@ NEXT_PUBLIC_SUPABASE_ANON_KEY=# PRIVATEOPENAI_KEY=SUPABASE_SERVICE_ROLE_KEY=+SEARCH_GITHUB_APP_ID=+SEARCH_GITHUB_APP_INSTALLATION_ID=+SEARCH_GITHUB_APP_PRIVATE_KEY=# Set IS_PLATFORM to true if you have the api keys and urlsNEXT_PUBLIC_IS_PLATFORM=falsediff --git a/apps/docs/package.json b/apps/docs/package.jsonindex ade4f37f9a4..0eb29301d62 100644--- a/apps/docs/package.json+++ b/apps/docs/package.json@@ -47,6 +47,7 @@"@mdx-js/loader": "^1.6.22","@mdx-js/react": "^1.6.22","@next/mdx": "^12.0.4",+ "@octokit/auth-app": "^4.0.9","@octokit/core": "^4.2.0","@octokit/plugin-paginate-graphql": "^2.0.1","@radix-ui/react-accordion": "^1.0.1",diff --git a/apps/docs/scripts/search/generate-embeddings.ts b/apps/docs/scripts/search/generate-embeddings.tsindex 93f6841c014..69a35a14f20 100644--- a/apps/docs/scripts/search/generate-embeddings.ts+++ b/apps/docs/scripts/search/generate-embeddings.ts@@ -17,7 +17,9 @@ async function generateEmbeddings() {'NEXT_PUBLIC_SUPABASE_URL','SUPABASE_SERVICE_ROLE_KEY','OPENAI_KEY',- 'GITHUB_ACCESS_TOKEN',+ 'SEARCH_GITHUB_APP_ID',+ 'SEARCH_GITHUB_APP_INSTALLATION_ID',+ 'SEARCH_GITHUB_APP_PRIVATE_KEY',]if (requiredEnvVars.some((name) => !process.env[name])) {diff --git a/apps/docs/scripts/search/sources/github-discussion.ts b/apps/docs/scripts/search/sources/github-discussion.tsindex d60a06c6e5a..3280d84ce47 100644--- a/apps/docs/scripts/search/sources/github-discussion.ts+++ b/apps/docs/scripts/search/sources/github-discussion.ts@@ -1,3 +1,4 @@+import { createAppAuth } from '@octokit/auth-app'import { Octokit } from '@octokit/core'import { paginateGraphql } from '@octokit/plugin-paginate-graphql'import { createHash } from 'crypto'@@ -28,7 +29,14 @@ export type DiscussionsResponse = {* Fetches GitHub discussions for a repository + category*/export async function fetchDiscussions(owner: string, repo: string, categoryId: string) {- const octokit = new ExtendedOctokit({ auth: process.env.GITHUB_ACCESS_TOKEN })+ const octokit = new ExtendedOctokit({+ authStrategy: createAppAuth,+ auth: {+ appId: process.env.SEARCH_GITHUB_APP_ID,+ installationId: process.env.SEARCH_GITHUB_APP_INSTALLATION_ID,+ privateKey: process.env.SEARCH_GITHUB_APP_PRIVATE_KEY,+ },+ })const {repository: {diff --git a/package-lock.json b/package-lock.jsonindex 2222a033062..ae79740a852 100644--- a/package-lock.json+++ b/package-lock.json@@ -42,6 +42,7 @@"@mdx-js/loader": "^1.6.22","@mdx-js/react": "^1.6.22","@next/mdx": "^12.0.4",+ "@octokit/auth-app": "^4.0.9","@octokit/core": "^4.2.0","@octokit/plugin-paginate-graphql": "^2.0.1","@radix-ui/react-accordion": "^1.0.1",@@ -51506,6 +51507,7 @@"@mdx-js/loader": "^1.6.22","@mdx-js/react": "^1.6.22","@next/mdx": "^12.0.4",+ "@octokit/auth-app": "^4.0.9","@octokit/core": "^4.2.0","@octokit/plugin-paginate-graphql": "^2.0.1","@radix-ui/react-accordion": "^1.0.1",