Closed zerenxyz closed 1 year ago
This plugin uses the git history to determine the creation date and the revision date. However, many build systems optimize by using git clone --depth 1
, meaning they only download the last commit. That means the last revision date and the creation date become the same.
So you need to update your deployment. For instructions, see the README (screenshot below)
Or the documentation: https://timvink.github.io/mkdocs-git-revision-date-localized-plugin/index.html#note-when-using-build-environments
Yup, I did set in the ci.yml (forgot to update the issue text) fetch-update=0 like so
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
so the build deployment looked like this:
name: ci
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
- run: pip install mkdocs-material
- name: Install Plugins
run: |
pip install \
"mkdocs-git-revision-date-localized-plugin" \
- run: mkdocs gh-deploy --force
But the issue still happens, unless im not doing it correctly?
I don't think it's setup correctly. Your first checkout (with V3) is correct, but is then overwritten on your second checkout (with V2).
Remove the line with - uses: actions/checkout@v2
@zerenxyz did that solve the issue for you?
Apologies, I have been out of work for some time since I made this issue and did not get the chance to test it, I willt test it tomorrow and let you know! Sorry for the delay!
@timvink I tested it with the solution and removing the - uses: actions/checkout@v2
was the issue and is now fixed! Thank you!
You're welcome!
I am using mkdocs-material-insiders (this issue is also the same with mkdocs-material, the example below does the same issue for me) with the plugin, locally the file last edited and created date work correctly, when updating document it only updates last edited time. However, when pushing to github repo and publishing the site with workflow/ci.yml it updates both last edited and created time to when the site was published that moment.
Here is my project setup: (You can access the repo in https://github.com/zerenxyz/mkdocs-material-plugin its public, I made it to test and it is still happening on a fresh install) mkdocs.yml
ci.yml
I asked in the mkdocs-material matrix chat, and did try with fetch-depth=0 in the ci.yml but the issue still happens.
For me running the project locally works fine, but issue is when it is on github pages for some reason resets all of created time to be the same as edited time.