Skip to content
On this page

解决Github action与Cloudflare page打包时git提交记录获取不全问题

当使用github action和cloudflare page打包时,如果需要git提交记录来生成某些文件,如:sitemap文件。此时会发现,在工作流中,只拉取了最后的一条提交记录,本文将提供对应的解决方案。

Github action解决方案

在workflows配置文件中添加fetch-depth参数

yml
- uses: actions/checkout@v3
    with:
      fetch-depth: 0

Cloudflare Page解决方案

在执行指令前添加

bash
git fetch --unshallow &&

例如

bash
git fetch --unshallow && npm run build

上次更新于: