Skip to content

PROTM-2268: Broaden CI-provider auto-detection - #179

Open
sandshoes wants to merge 1 commit into
mainfrom
tommy/protm-2268-ts-sdk-broaden-ci-detection
Open

sandshoes wants to merge 1 commit into
mainfrom
tommy/protm-2268-ts-sdk-broaden-ci-detection

Conversation

@sandshoes

Copy link
Copy Markdown
Contributor

Summary

  • isPreviewEnvironment() in src/client/preview.ts only recognized Vercel, GitHub Actions, GitLab, and generic CI as preview environments, even though getPreviewBranchName() already had branch-name support for CircleCI, Azure Pipelines, and Bitbucket Pipelines.
  • Adds PR-context detection for those three providers so they're correctly treated as preview environments, bringing the TypeScript SDK to parity with the provider list documented for the Python SDK.
  • Env vars used per provider (actual PR/merge-request context, not just "running in CI"):
    • CircleCI: CIRCLE_PULL_REQUEST (set to the PR URL when a build is triggered by a pull request)
    • Azure DevOps: SYSTEM_PULLREQUEST_PULLREQUESTID (set only on PR-triggered pipeline runs)
    • Bitbucket Pipelines: BITBUCKET_PR_ID (set only when the pipeline is triggered by a pull request)
  • Updated the function's doc comment to list all six supported providers.

Linear issue: https://linear.app/tinybird/issue/PROTM-2268/typescript-sdk-broaden-ci-provider-auto-detection

Test plan

  • Added test cases in src/client/preview.test.ts for each new provider, covering both the true (PR env var set) and false (only branch env var set, no PR indicator) conditions
  • pnpm typecheck passes
  • pnpm test:run passes (1071/1071 tests, including 31 in preview.test.ts)

🤖 Generated with Claude Code

isPreviewEnvironment() only recognized Vercel, GitHub Actions, GitLab,
and generic CI, even though getPreviewBranchName() already supported
CircleCI, Azure Pipelines, and Bitbucket Pipelines branch names. Add
PR-context detection for those three providers (CIRCLE_PULL_REQUEST,
SYSTEM_PULLREQUEST_PULLREQUESTID, BITBUCKET_PR_ID) so the SDK treats
them as preview environments too, bringing the TS SDK to parity with
the Python SDK's provider list.

Fixes PROTM-2268

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant