Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(docs ci): stop Docs E2E blocking pull requests it shouldn't (#48726)

Miranda Limonczenkod45e0cd3d520
diff --git a/.github/workflows/docs-e2e.yml b/.github/workflows/docs-e2e.yml
index 06c68d4c2f1..0cc745fad25 100644
--- a/.github/workflows/docs-e2e.yml
+++ b/.github/workflows/docs-e2e.yml
@@ -139,9 +139,12 @@ jobs:
# Poll the "Vercel – docs" commit status instead — Vercel keeps posting
# those — then resolve the deployment it points to via Vercel's own API
# to get the actual preview URL. See scripts/waitForVercelDocsPreview.js.
+ # A Vercel failure or timeout is not the author's problem, and the required
+ # "Vercel – docs" check already reports it. Resolve no URL and skip below.
- name: Wait for Vercel docs preview
if: steps.scope.outputs.skip == 'false' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && steps.changes.outputs.docs_app == 'true'
id: deployment
+ continue-on-error: true
run: node scripts/waitForVercelDocsPreview.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -156,30 +159,61 @@ jobs:
EVENT_NAME: ${{ github.event_name }}
BASE_URL_INPUT: ${{ inputs.base_url }}
DEPLOYMENT_URL: ${{ steps.deployment.outputs.deployment-url }}
- DOCS_APP_CHANGED: ${{ steps.changes.outputs.docs_app }}
+ PAGE_PATHS: ${{ steps.scope.outputs.paths }}
run: |
+ set -euo pipefail
+
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
printf 'url=%s\n' "$BASE_URL_INPUT" >> "$GITHUB_OUTPUT"
- echo "use_bypass=false" >> "$GITHUB_OUTPUT"
- elif [ "$DOCS_APP_CHANGED" = "true" ] && [ -n "$DEPLOYMENT_URL" ]; then
+ # Non-production targets are previews, which may need the bypass.
+ if [ "$BASE_URL_INPUT" = "https://supabase.com" ]; then
+ echo "use_bypass=false" >> "$GITHUB_OUTPUT"
+ else
+ echo "use_bypass=true" >> "$GITHUB_OUTPUT"
+ fi
+ echo "should_test=true" >> "$GITHUB_OUTPUT"
+ exit 0
+ fi
+
+ if [ -n "$DEPLOYMENT_URL" ]; then
printf 'url=%s\n' "$DEPLOYMENT_URL" >> "$GITHUB_OUTPUT"
echo "use_bypass=true" >> "$GITHUB_OUTPUT"
- else
- # Harness-only PRs have no docs preview; test against production.
- echo "url=https://supabase.com" >> "$GITHUB_OUTPUT"
- echo "use_bypass=false" >> "$GITHUB_OUTPUT"
+ echo "should_test=true" >> "$GITHUB_OUTPUT"
+ exit 0
fi
+ # Production is not a substitute: it lacks pages this pull request
+ # adds, so testing it fails a required check for a valid change.
+ echo "url=" >> "$GITHUB_OUTPUT"
+ echo "use_bypass=false" >> "$GITHUB_OUTPUT"
+ echo "should_test=false" >> "$GITHUB_OUTPUT"
+ echo "::warning::No Vercel docs preview URL for this pull request, so there is nothing serving its content to test. Skipping Playwright rather than testing production, which does not have pages this pull request adds."
+ {
+ echo "### Docs E2E skipped: no preview to test against"
+ echo
+ echo "Nothing is serving this pull request's content, and production is not a"
+ echo "substitute — pages it adds do not exist there yet."
+ echo
+ echo "Fork pull requests reach this path because they run without repository"
+ echo "secrets. A maintainer can run the suite against the preview manually:"
+ echo
+ echo '```'
+ echo "gh workflow run docs-e2e.yml \\"
+ echo " -f base_url=<preview-url> \\"
+ echo " -f page_paths=$PAGE_PATHS"
+ echo '```'
+ } >> "$GITHUB_STEP_SUMMARY"
+
- name: Install dependencies
- if: steps.scope.outputs.skip == 'false'
+ if: steps.base-url.outputs.should_test == 'true'
run: pnpm install --frozen-lockfile --filter=e2e-docs...
- name: Install Playwright Chromium
- if: steps.scope.outputs.skip == 'false'
+ if: steps.base-url.outputs.should_test == 'true'
run: pnpm -C e2e/docs exec playwright install chromium --with-deps --only-shell
- name: Run docs E2E
- if: steps.scope.outputs.skip == 'false'
+ if: steps.base-url.outputs.should_test == 'true'
working-directory: e2e/docs
run: pnpm run e2e:docs
env:
diff --git a/apps/docs/features/docs/GuidesMdx.template.tsx b/apps/docs/features/docs/GuidesMdx.template.tsx
index 04944e577a8..0a3786630b6 100644
--- a/apps/docs/features/docs/GuidesMdx.template.tsx
+++ b/apps/docs/features/docs/GuidesMdx.template.tsx
@@ -95,6 +95,7 @@ const GuideTemplate = ({
<article
// Used to get headings for the table of contents
id="sb-docs-guide-main-article"
+ data-testid="sb-docs-guide-main-article"
className="prose max-w-none"
>
<header className="mb-8">
diff --git a/apps/docs/features/docs/Troubleshooting.page.tsx b/apps/docs/features/docs/Troubleshooting.page.tsx
index 805623bbe5e..4e998f4ac44 100644
--- a/apps/docs/features/docs/Troubleshooting.page.tsx
+++ b/apps/docs/features/docs/Troubleshooting.page.tsx
@@ -20,7 +20,11 @@ export default async function TroubleshootingPage({ entry }: { entry: ITroublesh
>
<div className="px-5 py-8 lg:px-0 lg:py-0">
<Breadcrumbs minLength={1} forceDisplayOnMobile />
- <article className="prose max-w-none mt-4">
+ <article
+ id="sb-docs-troubleshooting-main-article"
+ data-testid="sb-docs-troubleshooting-main-article"
+ className="prose max-w-none mt-4"
+ >
<h1>{entry.data.title}</h1>
{dateUpdated && (
<p className="text-sm text-foreground-lighter">
diff --git a/apps/docs/features/ui/guide/GuideArticle.tsx b/apps/docs/features/ui/guide/GuideArticle.tsx
index b23cce3aaab..3d74842b44a 100644
--- a/apps/docs/features/ui/guide/GuideArticle.tsx
+++ b/apps/docs/features/ui/guide/GuideArticle.tsx
@@ -14,6 +14,7 @@ export function GuideArticle({ children, className }: GuideArticleProps) {
<article
// Used to get headings for the table of contents
id="sb-docs-guide-main-article"
+ data-testid="sb-docs-guide-main-article"
className={cn('prose max-w-none', className)}
>
{children}
diff --git a/e2e/docs/utils/docs-links.ts b/e2e/docs/utils/docs-links.ts
index 3c4a8471c09..7e483ba5a87 100644
--- a/e2e/docs/utils/docs-links.ts
+++ b/e2e/docs/utils/docs-links.ts
@@ -1,13 +1,14 @@
import type { Page } from '@playwright/test'
-export const GUIDE_ARTICLE_SELECTOR = '#sb-docs-guide-main-article'
-export const TROUBLESHOOTING_ARTICLE_SELECTOR = 'article.prose'
+export const GUIDE_ARTICLE_SELECTOR = '[data-testid="sb-docs-guide-main-article"]'
+export const TROUBLESHOOTING_ARTICLE_SELECTOR =
+ '[data-testid="sb-docs-troubleshooting-main-article"]'
const DOCS_PATH_PREFIX = '/docs'
const TROUBLESHOOTING_PATH_PREFIX = '/docs/guides/troubleshooting/'
/**
* Pick the main article selector for a docs page path.
- * Guides use a stable id; troubleshooting entries use a plain prose article.
+ * Both guides and troubleshooting entries expose a stable data-testid.
*/
export function articleSelectorForPagePath(pagePath: string): string {
const pathname = pagePath.startsWith('http') ? new URL(pagePath).pathname : pagePath