Skip to content
Ona Docs

ParseContextURL

client.Runners.ParseContextURL(ctx, body) (*RunnerParseContextURLResponse, error)
POST/gitpod.v1.RunnerService/ParseContextURL

Parses a context URL and returns the parsed result.

Use this method to:

  • Validate context URLs
  • Check repository access
  • Verify branch existence

Returns:

  • FAILED_PRECONDITION if authentication is required
  • PERMISSION_DENIED if access is not allowed
  • INVALID_ARGUMENT if URL is invalid
  • NOT_FOUND if repository/branch doesn’t exist

Examples

  • Parse URL:

    Parses and validates a context URL.

    contextUrl: "https://github.com/org/repo/tree/main"
ParametersExpand Collapse
body RunnerParseContextURLParams
ContextURL param.Field[string]Optional
formaturi
RunnerID param.Field[string]Optional
formatuuid
ReturnsExpand Collapse
type RunnerParseContextURLResponse struct{…}
Git RunnerParseContextURLResponseGitOptional
Branch stringOptional
CloneURL stringOptional
Commit stringOptional
Host stringOptional
Owner stringOptional
Repo stringOptional
Tag stringOptional
UpstreamRemoteURL stringOptional
Issue RunnerParseContextURLResponseIssueOptional
ID stringOptional

id is the source system’s ID of this issue, e.g. BNFRD-6100

Title stringOptional
OriginalContextURL stringOptional
DeprecatedPr RunnerParseContextURLResponsePrOptional

Deprecated: Use top-level PullRequest message instead

ID stringOptional
FromBranch stringOptional
Title stringOptional
ToBranch stringOptional
ProjectIDs []stringOptional

project_ids is a list of projects to which the context URL belongs to.

PullRequest RunnerParseContextURLResponsePullRequestOptional

PullRequest represents pull request metadata from source control systems. This message is used across workflow triggers, executions, and agent contexts to maintain consistent PR information throughout the system.

ID stringOptional

Unique identifier from the source system (e.g., “123” for GitHub PR #123)

Author stringOptional

Author name as provided by the SCM system

Draft boolOptional

Whether this is a draft pull request

FromBranch stringOptional

Source branch name (the branch being merged from)

Repository RunnerParseContextURLResponsePullRequestRepositoryOptional

Repository information

CloneURL stringOptional
Host stringOptional
Name stringOptional
Owner stringOptional
State StateOptional

Current state of the pull request

One of the following:
const StateUnspecified State = "STATE_UNSPECIFIED"
const StateOpen State = "STATE_OPEN"
const StateClosed State = "STATE_CLOSED"
const StateMerged State = "STATE_MERGED"
Title stringOptional

Pull request title

ToBranch stringOptional

Target branch name (the branch being merged into)

URL stringOptional

Pull request URL (e.g., “https://github.com/owner/repo/pull/123”)

ScmID stringOptional

scm_id is the unique identifier of the SCM provider (e.g., “github”, “gitlab”, “bitbucket”)

ParseContextURL

package main

import (
  "context"
  "fmt"

  "github.com/gitpod-io/gitpod-sdk-go"
  "github.com/gitpod-io/gitpod-sdk-go/option"
)

func main() {
  client := gitpod.NewClient(
    option.WithBearerToken("My Bearer Token"),
  )
  response, err := client.Runners.ParseContextURL(context.TODO(), gitpod.RunnerParseContextURLParams{
    ContextURL: gitpod.F("https://github.com/org/repo/tree/main"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Git)
}
{
  "git": {
    "branch": "branch",
    "cloneUrl": "cloneUrl",
    "commit": "commit",
    "host": "host",
    "owner": "owner",
    "repo": "repo",
    "tag": "tag",
    "upstreamRemoteUrl": "upstreamRemoteUrl"
  },
  "issue": {
    "id": "id",
    "title": "title"
  },
  "originalContextUrl": "originalContextUrl",
  "pr": {
    "id": "id",
    "fromBranch": "fromBranch",
    "title": "title",
    "toBranch": "toBranch"
  },
  "projectIds": [
    "string"
  ],
  "pullRequest": {
    "id": "id",
    "author": "author",
    "draft": true,
    "fromBranch": "fromBranch",
    "repository": {
      "cloneUrl": "cloneUrl",
      "host": "host",
      "name": "name",
      "owner": "owner"
    },
    "state": "STATE_UNSPECIFIED",
    "title": "title",
    "toBranch": "toBranch",
    "url": "url"
  },
  "scmId": "scmId"
}
Returns Examples
{
  "git": {
    "branch": "branch",
    "cloneUrl": "cloneUrl",
    "commit": "commit",
    "host": "host",
    "owner": "owner",
    "repo": "repo",
    "tag": "tag",
    "upstreamRemoteUrl": "upstreamRemoteUrl"
  },
  "issue": {
    "id": "id",
    "title": "title"
  },
  "originalContextUrl": "originalContextUrl",
  "pr": {
    "id": "id",
    "fromBranch": "fromBranch",
    "title": "title",
    "toBranch": "toBranch"
  },
  "projectIds": [
    "string"
  ],
  "pullRequest": {
    "id": "id",
    "author": "author",
    "draft": true,
    "fromBranch": "fromBranch",
    "repository": {
      "cloneUrl": "cloneUrl",
      "host": "host",
      "name": "name",
      "owner": "owner"
    },
    "state": "STATE_UNSPECIFIED",
    "title": "title",
    "toBranch": "toBranch",
    "url": "url"
  },
  "scmId": "scmId"
}