[CLOUD-270] Sync private repositories through GitHub App
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:
- I extracted the previously embedded function body of
GetRemoteURLFunc
to its own function (getRemoteURLFunc
) in order to write tests for it. - 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
- 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.
- Pick at least one public and one private repositories to be synced into Sourcegraph.
- All selected repositories should be available for search once the initial cloning is done.
Jira: CLOUD-270