Repository navigation
feat(sdk): detect PR context on GitHub Enterprise, self-managed GitLab and Azure DevOps Server (#241) - #242
Merged
Merged
Conversation
…b and Azure DevOps Server (#241) PR context now records the server the repository lives on (PullRequestContext.ServerUrl), so the github.com / gitlab.com / Azure DevOps Services-only gates are gone: - GitHub Actions: server from GITHUB_SERVER_URL (github.com, GHE.com, GHES). - GitLab: server from CI_SERVER_URL (port and relative root included) instead of CI_SERVER_HOST. - Azure Pipelines: GitHub and GitHubEnterprise providers take the server from BUILD_REPOSITORY_URI; TfsGit accepts Azure DevOps Server collections (owner {collection}/{project}). Both Azure DevOps Services URL forms normalize to https://dev.azure.com. - Jenkins: the platform is read from the CHANGE_URL path shape on any host. CI metadata gains CI.ServerUrl (GitHub, GitLab, Azure Pipelines, Bitbucket), normalized the same way, so CI.Repository is no longer ambiguous across servers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Review follow-ups on #242: - Azure Pipelines: CI.ServerUrl for Azure Repos comes from SYSTEM_COLLECTIONURI, like the PR context, so legacy visualstudio.com organizations report https://dev.azure.com and Azure DevOps Server keeps its virtual directory (/tfs). - Bitbucket: CI.ServerUrl is no longer recorded. Pipelines only runs on bitbucket.org, and its origin variable is http://, which disagreed with https identities. - Jenkins: a CHANGE_URL with a "_git" segment that isn't Azure Repos (a GitLab project named _git) falls through to the GitLab and GitHub parsers instead of returning null. - Jenkins: document that a GitLab relative URL root makes Jenkins and GitLab CI report different identities. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #241 (SDK side). The Cloud side is a separate dashboard PR that bumps to the package this publishes.
What changes for users
PR builds on GitHub Enterprise Server, GHE.com, self-managed GitLab and Azure DevOps Server now get PR context instead of being filed as plain branch runs.
How
PullRequestContext.ServerUrl: the server the repository lives on, normalized to scheme, lowercase host, non-default port and path, with no trailing/. The same repo gets the same value from every detector.GITHUB_SERVER_URL. A missing value still warns.CI_SERVER_URLreplacesCI_SERVER_HOST, so the port and relative root are kept.GitHub/GitHubEnterpriseproviders: the server comes fromBUILD_REPOSITORY_URI.TfsGit: Azure DevOps Server collections are accepted, with owner{collection}/{project}.dev.azure.comand*.visualstudio.comboth map tohttps://dev.azure.com.CHANGE_URLpath shape on any host:/pull/nis GitHub,/-/merge_requests/nis GitLab,/_git/r/pullrequest/nis Azure Repos.pullsand Bitbucketpull-requestsstill return null.CI.ServerUrlis now set on GitHub Actions, GitLab, Azure Pipelines and Bitbucket, soCI.Repositoryis no longer ambiguous across servers (CI.Repository has no host, so GitHub Enterprise runs can be matched to github.com repos #240).configuration-reference.mdandci-cd-setup.md. They now say PR comments are github.com-only; that's tracked on the Cloud side.Tests
ServerUrl.GitHubEnterprisepaths, self-hosted JenkinsCHANGE_URLs, andCI.ServerUrlper platform.ServerUrl.dotnet build -c Releaseis clean,dotnet format --verify-no-changespasses, and all six test projects pass.🤖 Generated with Claude Code