Skip to content

Fix GitHub Import when importing from GHE

Rodrigo Tomonari requested to merge rodrigo/fix-github-enterprise-import into master

What does this MR do and why?

Updated GitHubImport::Client to include the /api/v3 path when importing from GitHub Enterprise. The path is required because in GHE, the API is located in this path and not in the api. subdomain like GitHub Cloud.

For context, this bug was introduced in GitLab 16.5 when GitHub Import stopped using Gilab::LegacyGithubImport::Client which used to set the path.

Related to: #438358

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

To test the feature a GitHub Enterprise instance is required.

A GitHub Enterprise instance can be installed in GCP using these steps. Our you can ping me and I can share the credentials of an instance I setup.

After that, you can start an import via API:

curl --location 'http://gdk.test:3000/api/v4/import/github' \
--header 'Content-Type: application/json' \
--header 'Authorization: Beare ACCESS_TOKEN' \
--data '{
    "personal_access_token": "GITHUB_ENTERPRISE_ACCESS_TOKEN",
    "repo_id": "1", 
    "target_namespace": "root",
    "github_hostname": "http://example.github.com",
    "new_name": "ghe"
}'
Edited by Rodrigo Tomonari

Merge request reports