Comments (3)
Hi @lyz-code,
Good to hear you're happy with the plugin!
Trying to understand if something is going wrong or not. What this plugin does, is on mkdocs build
lookup for each markdown file the datetime of the last commit that touched it. So on each deploy, all files are rechecked.
So I checked if there are any pages with incorrect timeago stamps. Let's take one file as an example: devops/aws/iam/iam_commands/index.html
went:
- from Wednesday, February 12, 2020 5:39:54 PM GMT (1581529194000)
- to Wednesday, February 12, 2020 5:43:08 PM GMT(1581529388000)
The last commit on iam_commands.md was earlier, on 12 Feb 2020 10:36 GMT.
After some more searching, I realised that the date is actually the timestamp when the deploy script ran. This is likely because of these lines in the plugin:
unix_timestamp = self.g.log(path, n=1, date='short', format='%at')
if not unix_timestamp:
unix_timestamp = datetime.now().timestamp()
print('WARNING - %s has no git logs, using current timestamp' % path)
Basically, the git repository cannot be properly accessed, and the current datetime is taken. The logs should show a lot of warnings. Unfortunately, I cannot view the logs of your build ('We are currently unable to download the log. Please try again later.').
Probably, the root cause is that the github action actions/checkout@v2
by default only checks out a single commit, for speed reasons (see docs). I suggest to update your workflow and increase the fetch-depth, because you need all the commits on all the files:
steps:
- uses: actions/checkout@v2
with:
# Number of commits to fetch. 0 indicates all history.
# Default: 1
fetch-depth: 0
Let me know if that solves it. I will make sure to update the docs and the warning message accordingly to help future users.
from mkdocs-git-revision-date-localized-plugin.
It worked perfectly.
Thank you for the quick and throughout analysis ^^
from mkdocs-git-revision-date-localized-plugin.
I tried writing a unit test for this. I had assumed the shallow git fetch-depth of 1 would have caused this line to return a None
:
unix_timestamp = self.g.log(path, n=1, date='short', format='%at')
and thus print these warnings:
if not unix_timestamp:
unix_timestamp = datetime.now().timestamp()
print('WARNING - %s has no git logs, using current timestamp' % path)
I looked at the logs of your build job, and there's no warnings. I couldn't reproduce this locally.
Instead, the git date returned can just be plain wrong, containing the last commit date.
I've already updated the README.md
with instructions when building docs with CI, but I'd like to raise appropriate warnings as well.
But determining the GIT_DEPTH
is not trivial, as described in this SO post. In the end I reverted to printing some warnings for shallow clones on CI.
from mkdocs-git-revision-date-localized-plugin.
Related Issues (20)
- Edited and Created time become same when publishing with github pages HOT 7
- ``InvalidGitRepositoryError`` during build when including auto-generated files HOT 8
- Unable to set any configurations HOT 12
- Typo in variable names HOT 2
- The plugin breaks with the last mkdocs docker image HOT 3
- The plugin breaks with squidfunk/mkdocs-material:9.0.3 HOT 1
- Is there a way to turn off warnings? HOT 4
- Improve error message for dubious git ownership HOT 2
- if a file has no git logs, use the last modified timestamp instead of the current HOT 4
- which themes will this plugin work?
- Feature request: exclude specific commits when calculating the 'last update' calculation HOT 3
- Poor performance on large monorepos HOT 3
- Timeago setting results in incorrect items being added to extra_javascript HOT 2
- Create date not correct on Github pages HOT 4
- Document how to use sparse checkouts
- correctly populate `lastmod` of `sitemap.xml` HOT 2
- DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version HOT 1
- Cloudflare Pages fetch-depth HOT 6
- 1.2.3 breaks integration with Material for MkDocs HOT 5
- Whitelist / Negate certain excludes with a `!`? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mkdocs-git-revision-date-localized-plugin.