mkdocs-git-revision-date-localized-plugin icon indicating copy to clipboard operation
mkdocs-git-revision-date-localized-plugin copied to clipboard

Both creation & last modified dates on all tracked files keep updating to the date/time of last commit.

Open rmscode opened this issue 1 year ago • 2 comments

I just noticed this today. On github pages, all my pages are showing a date/time that matches my last commit from this afternoon. My local builds do not exhibit the same behavior...They are accurate.

rmscode avatar Jun 26 '24 19:06 rmscode

Are you talking about the creation date? --> Have a look at the note on build systems in the docs (https://timvink.github.io/mkdocs-git-revision-date-localized-plugin/index.html). github does not fetch all commit history by default

Are you talking about the last modified date? --> Do you have the fallback_to_build_date option (docs) enabled?

  • If yes, try disabling it, and share the error message
  • If not, please provide a bit more information; for example, do you have a public repo where I can see your github actions config?

timvink avatar Jun 26 '24 19:06 timvink

Update: Added fetch-depth: 0, but it made no difference.

Sorry, I was in a bit of a rush.

Yes, I meant the creation date and the last modified date.

image

I do not have fallback_to_build_date enabled.

Here are the current plugin options:

- git-revision-date-localized:
      enable_creation_date: true
      type: datetime
      timezone: America/New_York
      exclude:
        - index.md
        - notes/*

This is my github actions config:

name: mydocs-gh-pages-deploy 
on:
  push:
    branches:
      - main
permissions:
  contents: write
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Configure Git Credentials
        run: |
          git config user.name github-actions[bot]
          git config user.email 74937203+github-actions[bot]@users.noreply.github.com
      - uses: actions/setup-python@v4
        with:
          python-version: 3.x
      - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV 
      - uses: actions/cache@v3
        with:
          key: mkdocs-material-${{ env.cache_id }}
          path: .cache
          restore-keys: |
            mkdocs-material-
      - run: pip install mkdocs-material 
      - run: pip install mkdocs-encryptcontent-plugin
      - run: pip install mkdocs-git-revision-date-localized-plugin
      - run: pip install mkdocs-git-latest-changes-plugin
      - run: mkdocs gh-deploy --force

rmscode avatar Jun 27 '24 13:06 rmscode

So many build systems do not fetch the full commit history (for obvious reasons). You need to configure that explicitly, see the documentation note on build systems in the docs: https://timvink.github.io/mkdocs-git-revision-date-localized-plugin/index.html#note-when-using-build-environments

You're the third person this week hitting this; I will try to make that section in the docs easier to find.

timvink avatar Jun 30 '24 11:06 timvink

Thank you. You did point that out earlier and I did try fetch-depth to 0, but it hasn't changed anything. Maybe I placed that param in the wrong part of my actions config?

name: mydocs-gh-pages-deploy 
on:
  push:
    branches:
      - main
permissions:
  contents: write
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Configure Git Credentials
        run: |
          git config user.name github-actions[bot]
          git config user.email 74937203+github-actions[bot]@users.noreply.github.com
      - uses: actions/setup-python@v4
        with:
          fetch-depth: 0 # <------ HERE?
          python-version: 3.x
      - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV 
      - uses: actions/cache@v3
        with:
          key: mkdocs-material-${{ env.cache_id }}
          path: .cache
          restore-keys: |
            mkdocs-material-
      - run: pip install mkdocs-material 
      - run: pip install mkdocs-encryptcontent-plugin
      - run: pip install mkdocs-git-revision-date-localized-plugin
      - run: pip install mkdocs-git-latest-changes-plugin
      - run: mkdocs gh-deploy --force
     ```

rmscode avatar Jul 01 '24 17:07 rmscode

No on checkout actions. Docs: https://github.com/actions/checkout

timvink avatar Jul 01 '24 17:07 timvink

Oh crap...I did have it in the wrong area. When I read the docs, I saw that it needed to be nested under - uses: actions/checkout@v4, but my eyes must have seen the actions/ bit of - uses: actions/setup-python@v4 and I placed it there. Whoops.

Thanks for the help.

rmscode avatar Jul 01 '24 17:07 rmscode