11ty-website icon indicating copy to clipboard operation
11ty-website copied to clipboard

add fetch-depth note to `git last modified` and `git created`

Open alifeee opened this issue 6 months ago • 2 comments

Add note

  • This needs an entire git history (which is often not the case in CI environments) or it will return the date of checkout. Fetch the entire history in your CI, for example in GitHub by setting fetch-depth: 0 with GitHub's checkout action.

to git Last Modified and git Created on the Content Dates page

Most CIs checkout a shallow copy of the repository, in which case the git Created and git Last Modified dates will be wrong. This reminds people to disable shallow-cloning if using these two date types.

For example, in GitHub actions you must run

      - name: Checkout
        uses: actions/checkout@v4
+       with:
+         fetch-depth: "0"

for git Created and git Last Modified to work with Eleventy on the runners

alifeee avatar Jan 25 '24 01:01 alifeee