Skip to content

bext: change the repo visibility check logic

Created by: taras-yemets

Closes https://github.com/sourcegraph/sourcegraph/issues/29244

Changes the way we check whether the repo is private or public on GitHub. The suggested implementation requests the repo page without credentials and if the response status is not 200 (404 or any other) repo is considered to be private. In this case we try to resolve the private repo on the Sourcegraph instance (this logic is not changed in the current PR).

Context: google doc, slack tread

Note: GitHub integration tests were not updated. Git LFS bandwidth limit was reached, thus updated tests recordings can't be fetched from or pushed to the LFS causing tests to fail (check https://github.com/sourcegraph/sourcegraph/issues/33484 for more details).

Test plan

Updated GitHub unit test: client/browser/src/shared/code-hosts/github/codeHost.test.ts

To check manually:

  • sg run bext
  • open the browser extension's background page
  • open a public repo on GitHub then check the background page network tab to ensure that ResolvePrivateRepo request has not been sent
  • open a private repo on GitHub then check the background page network tab to ensure that ResolvePrivateRepo request has been sent

App preview:

Merge request reports

Loading