quarto-dev / quarto-dev/quarto-cli
`last-modified` is not working as expected when rendering on github actions as Git does not store last modified date
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
In a github action rendering, there will be a checkout at each rendering. This implies that the last modified date of each file will be the same as the git checkout date. This is because of the fact that git does not store last modified date information.
There are workaround to restore date of file to last commit date for the files:
- https://github.com/BenLubar/git-last-modified
- https://stackoverflow.com/questions/21735435/git-clone-changes-file-modification-time/55609950#55609950
Maybe we could try be clever when inside a git project, or leverage the _freeze state for project to store information.
Discussed in https://github.com/quarto-dev/quarto-cli/discussions/5899
Originally posted by adityam June 13, 2023
Description
I am using github actions to publish my website.
- Website: https://adityam.github.io/stochastic-control/
- Github action: https://github.com/adityam/stochastic-control/blob/quarto/.github/workflows/quarto-render.yml
In _quarto.yml, I have set
format:
html:
published-title: Updated
date: last-modified
but all my pages have today's date.
I suspect that the last modified date is coming from the date the date when github CI clones the repo (and hence today's date) rather than when the file was checked into the repo (which is the true last-modified date).
Is it possible to somehow use the date when the file was last committed to git, for example, similar to what is available for hugo
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the rendering from the referenced .github/workflows/quarto-render.yml and inspect how date: last-modified is determined during a GitHub Actions checkout. Compare the checkout timestamp with the file's last commit date, then verify that rendered pages use the committed date rather than the checkout date.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, github-actions
- Domain
- ci-cd, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100