Skip to content
Ona Docs

CreateSCMIntegration

runners.configurations.scm_integrations.create(ScmIntegrationCreateParams**kwargs) -> ScmIntegrationCreateResponse
POST/gitpod.v1.RunnerConfigurationService/CreateSCMIntegration

Creates a new SCM integration for a runner.

Use this method to:

  • Configure source control access
  • Set up repository integrations
  • Enable code synchronization

Examples

  • Create GitHub integration:

    Sets up GitHub SCM integration.

    runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
    scmId: "github"
    host: "github.com"
    oauthClientId: "client_id"
    oauthPlaintextClientSecret: "client_secret"
ParametersExpand Collapse
host: Optional[str]
issuer_url: Optional[str]

issuer_url can be set to override the authentication provider URL, if it doesn’t match the SCM host.

oauth_client_id: Optional[str]

oauth_client_id is the OAuth app’s client ID, if OAuth is configured. If configured, oauth_plaintext_client_secret must also be set.

oauth_plaintext_client_secret: Optional[str]

oauth_plaintext_client_secret is the OAuth app’s client secret in clear text. This will first be encrypted with the runner’s public key before being stored.

pat: Optional[bool]
runner_id: Optional[str]
formatuuid
scm_id: Optional[str]

scm_id references the scm_id in the runner’s configuration schema that this integration is for

virtual_directory: Optional[str]

virtual_directory is the virtual directory path for Azure DevOps Server (e.g., “/tfs”). This field is only used for Azure DevOps Server SCM integrations and should be empty for other SCM types. Azure DevOps Server APIs work without collection when PAT scope is ‘All accessible organizations’.

ReturnsExpand Collapse
class ScmIntegrationCreateResponse:
id: Optional[str]

id is a uniquely generated identifier for the SCM integration

formatuuid

CreateSCMIntegration

import os
from gitpod import Gitpod

client = Gitpod(
    bearer_token=os.environ.get("GITPOD_API_KEY"),  # This is the default and can be omitted
)
scm_integration = client.runners.configurations.scm_integrations.create(
    host="github.com",
    oauth_client_id="client_id",
    oauth_plaintext_client_secret="client_secret",
    runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68",
    scm_id="github",
)
print(scm_integration.id)
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
Returns Examples
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}