GitHub: Start an import
GitHub migrations.migrationsStartImport: arguments, response, policy and SDK examples.
← Migrations operations · Get started
Operation github.migrations_start_import
Provider route: PUT /repos/{owner}/{repo}/import. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/github with npm, or alter-sdk-github with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { GitHubIntegration } from "@alter-ai/github";
async function execute(input: Parameters<GitHubIntegration["migrations"]["migrationsStartImport"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new GitHubIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.migrations.migrationsStartImport(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_github import GitHubIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = GitHubIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.migrations.migrations_start_import(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.owner | string | Required within parent | |
path.repo | string | Required within parent | |
body | object | Required within parent | |
body.tfvc_project | string | Optional | For a tfvc import, the name of the project that is being imported. |
body.vcs | string | Optional | The originating VCS type. Without this parameter, the import job will take additional time to detect the VCS type before beginning the import. This detection step will be reflected in the response. One of: subversion, git, mercurial, tfvc |
body.vcs_password | string | Optional | If authentication is required, the password to provide to `vcs_url`. |
body.vcs_url | string | Required within parent | The URL of the originating repository. |
body.vcs_username | string | Optional | If authentication is required, the username to provide to `vcs_url`. |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Start an import — response body |
Referenced models: Start an import — response body
Schemas
Section titled “Schemas”Start an import — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A repository import from an external source. |
authors_count | JSON | Optional | |
authors_count (anyOf 1) | JSON | Alternative | |
authors_count (anyOf 1) (anyOf 1) | integer | Alternative | |
authors_count (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
authors_count (anyOf 2) | null | Alternative | |
authors_url | string | Required within parent | Format: uri |
commit_count | JSON | Optional | |
commit_count (anyOf 1) | JSON | Alternative | |
commit_count (anyOf 1) (anyOf 1) | integer | Alternative | |
commit_count (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
commit_count (anyOf 2) | null | Alternative | |
error_message | JSON | Optional | |
error_message (anyOf 1) | string | Alternative | |
error_message (anyOf 2) | null | Alternative | |
failed_step | JSON | Optional | |
failed_step (anyOf 1) | string | Alternative | |
failed_step (anyOf 2) | null | Alternative | |
has_large_files | boolean | Optional | |
html_url | string | Required within parent | Format: uri |
import_percent | JSON | Optional | |
import_percent (anyOf 1) | JSON | Alternative | |
import_percent (anyOf 1) (anyOf 1) | integer | Alternative | |
import_percent (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
import_percent (anyOf 2) | null | Alternative | |
large_files_count | JSON | Optional | |
large_files_count (anyOf 1) | integer | Alternative | |
large_files_count (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
large_files_size | JSON | Optional | |
large_files_size (anyOf 1) | integer | Alternative | |
large_files_size (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
message | string | Optional | |
project_choices | array | Optional | |
project_choices[] | object | Each item | |
project_choices[].human_name | string | Optional | |
project_choices[].tfvc_project | string | Optional | |
project_choices[].vcs | string | Optional | |
push_percent | JSON | Optional | |
push_percent (anyOf 1) | JSON | Alternative | |
push_percent (anyOf 1) (anyOf 1) | integer | Alternative | |
push_percent (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
push_percent (anyOf 2) | null | Alternative | |
repository_url | string | Required within parent | Format: uri |
status | string | Required within parent | Known values: auth, error, none, detecting, choose, auth_failed, importing, mapping, waiting_to_push, pushing, complete, setup, unknown, detection_found_multiple, detection_found_nothing, detection_needs_auth |
status_text | JSON | Optional | |
status_text (anyOf 1) | string | Alternative | |
status_text (anyOf 2) | null | Alternative | |
svc_root | string | Optional | |
svn_root | string | Optional | |
tfvc_project | string | Optional | |
url | string | Required within parent | Format: uri |
use_lfs | boolean | Optional | |
vcs | JSON | Required within parent | |
vcs (anyOf 1) | string | Alternative | |
vcs (anyOf 2) | null | Alternative | |
vcs_url | string | Required within parent | The URL of the originating repository. |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: github.migrations_start_import. Catalog operation: migrations/start-import. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Pinned headers: {"X-GitHub-Api-Version": "2026-03-10", "User-Agent": "Alter", "Accept": "application/vnd.github+json"}