使用 git sparse-checkout 加快文档构建速度
¥Using git sparse-checkout for faster documentation builds
利用 GitHub Actions 中的 git sparse-checkout,我们可以加快存储库中的文档构建速度,将签出时间从 20 到 30 秒缩短到仅 2 秒。
¥Leveraging git sparse-checkout in GitHub Actions enabled us to speed up documentation builds in our repository, cutting checkout times from 20 to 30 seconds to just 2 seconds.
在持续集成 (CI) 工作流中,开发一种高效的文档构建方法至关重要,尤其是在像我们这样拥有数千条提交记录的大型代码库中工作时。当然,我们希望快速高效地构建文档,确保快速高效的工作流程。在使用出色的git-committers和git-revision-date-localized插件在每页底部显示文档贡献者和日期时,我们需要设置fetch-depth: 0 ,这导致代码库的检出时间需要 20 到 30 秒。通过利用GitHub Actions中的git sparse-checkout功能,检出时间缩短至 2 秒。
¥Developing an efficient approach to build documentation in CI workflows is essential, especially when working in large repositories with thousands of commits, like ours. Of course, we want to build documentation quickly and efficiently, ensuring fast and productive workflows. When using both the wonderful git-committers and git-revision-date-localized plugins to display document contributors and dates at the bottom of each page, we are required to set fetch-depth: 0, which resulted in checkout times of 20 to 30 seconds on our repository. By leveraging git sparse-checkout within GitHub Actions, check out time was brought down to 2 seconds.