Skip to content
Ona Docs

ParseContextURL

client.runners.parseContextURL(RunnerParseContextURLParams { contextUrl, runnerId } body, RequestOptionsoptions?): RunnerParseContextURLResponse { git, issue, originalContextUrl, 4 more }
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, runnerId }
contextUrl?: string
formaturi
runnerId?: string
formatuuid
ReturnsExpand Collapse
RunnerParseContextURLResponse { git, issue, originalContextUrl, 4 more }
git?: Git { branch, cloneUrl, commit, 5 more }
branch?: string
cloneUrl?: string
commit?: string
host?: string
owner?: string
repo?: string
tag?: string
upstreamRemoteUrl?: string
issue?: Issue { id, title }
id?: string

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

title?: string
originalContextUrl?: string
Deprecatedpr?: Pr { id, fromBranch, title, toBranch }

Deprecated: Use top-level PullRequest message instead

id?: string
fromBranch?: string
title?: string
toBranch?: string
projectIds?: Array<string>

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

pullRequest?: PullRequest { id, author, draft, 6 more }

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?: string

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

author?: string

Author name as provided by the SCM system

draft?: boolean

Whether this is a draft pull request

fromBranch?: string

Source branch name (the branch being merged from)

repository?: Repository { cloneUrl, host, name, owner }

Repository information

cloneUrl?: string
host?: string
name?: string
owner?: string
state?: State

Current state of the pull request

One of the following:
"STATE_UNSPECIFIED"
"STATE_OPEN"
"STATE_CLOSED"
"STATE_MERGED"
title?: string

Pull request title

toBranch?: string

Target branch name (the branch being merged into)

url?: string

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

scmId?: string

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

ParseContextURL

import Gitpod from '@gitpod/sdk';

const client = new Gitpod({
  bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
});

const response = await client.runners.parseContextURL({
  contextUrl: 'https://github.com/org/repo/tree/main',
});

console.log(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"
}