Skip to content

fix(docs): authenticate GitHub API calls in lint-warnings-guide - #43015

Merged
mattrossman merged 2 commits into
masterfrom
fix/docs-embeddings-github-rate-limit
Feb 19, 2026
Merged

mattrossman merged 2 commits into
masterfrom
fix/docs-embeddings-github-rate-limit

Conversation

@mattrossman

@mattrossman mattrossman commented Feb 19, 2026 •

Copy link
Copy Markdown
Contributor
  • LintWarningsGuideLoader was making unauthenticated GitHub API calls (60 req/hr per IP), causing flaky failures on shared CI runners
  • Uses the same GitHub App auth already in github-discussion.ts — no new env vars or deps needed

Fixes https://github.com/supabase/supabase/actions/runs/22184533189/job/64154440387

Use GitHub App auth (matching github-discussion.ts) to avoid
unauthenticated 60 req/hr IP-based rate limit on shared CI runners.
@vercel

vercel Bot commented Feb 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment, Open in v0 Feb 19, 2026 2:28pm
8 Skipped Deployments
Project Deployment Actions Updated (UTC)
cms Ignored Ignored Feb 19, 2026 2:28pm
studio Ignored Ignored Feb 19, 2026 2:28pm
design-system Skipped Skipped Feb 19, 2026 2:28pm
learn Skipped Skipped Feb 19, 2026 2:28pm
studio-self-hosted Skipped Skipped Feb 19, 2026 2:28pm
studio-staging Skipped Skipped Feb 19, 2026 2:28pm
ui-library Skipped Skipped Feb 19, 2026 2:28pm
zone-www-dot-com Skipped Skipped Feb 19, 2026 2:28pm

Request Review

@supabase

supabase Bot commented Feb 19, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Feb 19, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Enhanced documentation service security through improved GitHub authentication with environment-based credential configuration.

Walkthrough

The pull request updates the GitHub API authentication mechanism in the lint warnings guide search source script. It replaces basic Octokit initialization with GitHub App-based authentication by adding three environment variable checks (DOCS_GITHUB_APP_ID, DOCS_GITHUB_APP_INSTALLATION_ID, and DOCS_GITHUB_APP_PRIVATE_KEY). The private key from the environment variable is converted to PKCS8 PEM format using Node's crypto module, then passed to Octokit via the createAppAuth authentication strategy. The change maintains the existing interface while introducing a more secure, credential-based authentication flow for GitHub API interactions.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Feb 19, 2026
@mattrossman
mattrossman marked this pull request as ready for review February 19, 2026 14:26
@mattrossman
mattrossman merged commit bde827c into master Feb 19, 2026
18 checks passed
@mattrossman
mattrossman deleted the fix/docs-embeddings-github-rate-limit branch February 19, 2026 14:30
@github-actions

github-actions Bot commented Feb 19, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1771511528)

Score Average Improvements Regressions
Completeness 88.9% (+0pp) 2 🟢 1 🔴
Conciseness 0% (+0pp) - -
Goal Completion 87.5% (+0pp) 4 🟢 3 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+13pp) 1 🟢 -
Tool Usage 100% (+0pp) - -
Docs Faithfulness 58.3% (+3pp) 3 🟢 3 🔴
Correctness 100% (+21pp) 2 🟢 -
URL Validity 100% (+10pp) 1 🟢 -
Time_to_first_token 0.2tok (-0.07tok) 12 🟢 -
Llm_calls 8.5 (+0) 4 🟢 4 🔴
Tool_calls 3.47 (+0.31) 5 🟢 3 🔴
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 106567.33tok (+3369.47tok) 4 🟢 8 🔴
Prompt_cached_tokens 55203.56tok (-2058.67tok) 5 🟢 6 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 5073.56tok (-202.08tok) 8 🟢 4 🔴
Completion_reasoning_tokens 3765.33tok (-17.78tok) 8 🟢 4 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 111640.89tok (+3167.39tok) 5 🟢 7 🔴
Estimated_cost 0.02$ (+0$) 6 🟢 6 🔴
Duration 38.87s (-4.51s) 8 🟢 4 🔴
Llm_duration 75.87s (-7.96s) 8 🟢 4 🔴

barryroodt added a commit that referenced this pull request Aug 13, 2026
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Bug fix. Complete App configurations produce the same auth options as
before.

## What is the current behavior?

Without the docs GitHub App private key, two things fail for a
contributor:

- `pnpm run embeddings` aborts before doing any work. The lint warnings
source throws, and every source shares one `Promise.all` in
[`fetchAllSources()`](https://github.com/supabase/supabase/blob/master/apps/docs/scripts/search/sources/index.ts).
- `pnpm --filter docs build` exits 1 in prebuild, so the `npm run build`
pre-flight CONTRIBUTING.md asks for cannot run either:

```
Error: DOCS_GITHUB_APP_PRIVATE_KEY environment variable is required
    at octokit (apps/docs/lib/octokit.ts:21:13)
    at fetchAiSkills (apps/docs/scripts/federated-content/fetch-federated-content.ts:258:36)
```

Both read public content, so this is a rate-limit guard rather than
access control: App auth landed in #43015 because unauthenticated calls
(60 req/hr per IP) went flaky on shared runners.

## What is the new behavior?

`apps/docs/lib/octokit.auth.ts` adds one rung below the App: a token
from `GH_TOKEN`, then `GITHUB_TOKEN` (the precedence [`gh help
environment`](https://cli.github.com/manual/gh_help_environment)
documents), so `export GH_TOKEN=$(gh auth token)` is enough to build
locally. Still authenticated, so #43015's fix holds, and still an
authenticated Octokit client, so #44274 holds.

A partially configured App is now an error naming the missing vars,
rather than falling through to a token.

Used by the lint warnings loader and `lib/octokit.ts`. The two token
vars are declared in `apps/docs/turbo.jsonc` for
`turbo/no-undeclared-env-vars`.

## Additional context

With only `GH_TOKEN` set, `turbo run build --filter=docs --force` passes
4/4 and search-index source loading completes. `pnpm test` passes (20
files, 164 tests), and `tsc --noEmit` plus `pnpm run lint` match
`origin/master`. For a complete App config the auth options are
identical to before. Happy to post the fuller verification as a comment.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added flexible GitHub authentication for documentation services,
supporting GitHub App credentials or personal access tokens.
- GitHub App authentication is preferred when fully configured, with
token-based fallback when unavailable.
- Added support for both `GH_TOKEN` and `GITHUB_TOKEN`, with clear
precedence rules.

- **Bug Fixes**
- Improved configuration validation with clear errors for missing or
incomplete authentication settings.
- Standardized authentication across GitHub content and lint-warning
retrieval.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants