peaceiris/actions-hugo

Non-ascii filename breaks lastmod

lingsamuel opened this issue · 4 comments

Describe the bug

I enabled GitInfo and set fetch-depth: 0 in github actions.

Files with ascii filename works well. But files with Chinese (or non-ascii? not sure) always generate "now" as lastmod (just like GitInfo disabled).

I am not sure if it's a actions-hugo bug or hugo bug. But the lastmod works pretty well locally, so I guess it's the actions probelm?

To Reproduce

Steps to reproduce the behavior:

  1. Create post with Chinese filename, such as 中文文件名.md
  2. Push to the remote repo, the actions run and deploy
  3. Trigger the action without modifying the file above
  4. See the lastmod changes (in sitemap.xml or else)

Expected behavior

The lastmod should be stable.

Screenshots

image

This is my last deploy. lastmod of the Chinese filename post (the encoded url one) changed to "now".

Your YAML file

name: github pages

on:
  watch:
    types: started
  push:
    branches:
      - master

jobs:
  deploy:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true  # Fetch Hugo themes (true OR recursive)
          fetch-depth: 0    # Fetch all history for .GitInfo and .Lastmod

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: 'latest'
          extended: true

      - name: Build
        # run: hugo -t beautifulhugo --minify
        # run: hugo --minify --buildDrafts -t beautifulhugo --ignoreCache
        run: hugo --minify -t beautifulhugo --ignoreCache
      
      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          publish_branch: master
          #github_token: ${{ secrets.GITHUB_TOKEN }}
          personal_token: ${{ secrets.PERSONAL_TOKEN }}
          publish_dir: ./public
          external_repository: lingsamuel/lingsamuel.github.io

Additional context

Add any other context about the problem here.

I found some potential related issue:
gohugoio/hugo#3071
gohugoio/hugo#6803

I tried this:

jobs:
  deploy:
    runs-on: ubuntu-18.04
    steps:
      - name: disable quotePath
        run: git config --global core.quotePath false # HERE

      - uses: actions/checkout@v2
        with:
          submodules: true  # Fetch Hugo themes (true OR recursive)
          fetch-depth: 0    # Fetch all history for .GitInfo and .Lastmod

It works well now.

@peaceiris I think you could add this to the README

Done by #499, Thanks ʕ◔ϖ◔ʔ

This issue has been LOCKED because of it being resolved!

The issue has been fixed and is therefore considered resolved.
If you still encounter this or it has changed, open a new issue instead of responding to solved ones.