Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch docs from remote repos via git clone instead of individually requesting every file from GitHub. #3951

Open
sengi opened this issue Apr 13, 2023 · 1 comment
Labels
good first issue Issue is likely suitable for newcomers to the project.

Comments

@sengi
Copy link
Contributor

sengi commented Apr 13, 2023

GitHubRepoFetcher is super unkind to GitHub's HTTP API. We're basically crawling every remote repo that's listed in data/repos.yml and issuing an HTTP request for every file in its docs/ directory (including subdirs) on startup.

This makes for a miserable developer experience when trying to preview changes to documentation. Startup takes many minutes and often fails because we hit rate-limits (sometimes even when using an API token!) The worst part is that the tests take forever to run and depend on thousands of network requests all succeeding, to endpoints which are outside our control.

It'd be simpler, faster and more reliable just to clone the remote repos and read the .md docs from the local filesystem. We wouldn't even have to download the whole of each repo; it's possible to download just the docs directory for just the head of the default branch, by using clone --filter with sparse-checkout.

This would also let us ditch our homegrown cache mechanism, because the files will just stick around when developing locally and we can use the built-in cache in GitHub Actions.

@sengi sengi added the good first issue Issue is likely suitable for newcomers to the project. label Apr 13, 2023
@Dylan-fa
Copy link
Contributor

Hi, I had a go at implementing this issue in #4000. This is my first time writing Ruby or contributing to a govuk repository so please feel free to leave some feedback. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issue is likely suitable for newcomers to the project.
Projects
None yet
Development

No branches or pull requests

2 participants