Skip to content

[CLOUD-270] Sync private repositories through GitHub App

Administrator requested to merge jc/CLOUD-270-clone-private-repo-github-app into main

Created by: unknwon

Due to the fact that the code host connection created by the GitHub App does not currently store the access token in the config itself (which will be addressed separately with more care in CLOUD-255), we need to exchange an installation access token for our GitHub App in order to compose the repository clone URLs for repositories that are synced through GitHub App, at the time of cloning and updating.

Notes:

  1. I extracted the previously embedded function body of GetRemoteURLFunc to its own function (getRemoteURLFunc) in order to write tests for it.
  2. I am aware of similar boilerplates in other places already, but I choose to leave it for CLOUD-255 because I think it is currently unclear how to best utilize the code reusability within the scope of this PR.

Test plan

  1. Use our GitHub App local testing guide to set up the organization code host connection, allow access to at least one public and one private repositories for the installation.
  2. Pick at least one public and one private repositories to be synced into Sourcegraph.
  3. All selected repositories should be available for search once the initial cloning is done.

Jira: CLOUD-270

Merge request reports

Loading