Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Add last modified time recipe code? #8779

Closed
sarah11918 opened this issue Jul 11, 2024 · 4 comments · Fixed by #9520
Closed

Error in Add last modified time recipe code? #8779

sarah11918 opened this issue Jul 11, 2024 · 4 comments · Fixed by #9520
Labels
good first issue Good for newcomers help wanted Issues looking for someone to run with them! improve documentation Enhance existing documentation (e.g. add an example, improve description)

Comments

@sarah11918
Copy link
Member

📚 Subject area/topic

recipe -- remark plugin last modified time

📋 Page(s) affected (or suggested, for new content)

https://docs.astro.build/en/recipes/modified-time/

📋 Description of content that is out-of-date or incorrect

From Feedback Fish:

The recipe works on my local dev server, but when i deploy it via github action, for some reason i got 'Invalid date' instead. Im not too sure how to troubleshoot this issue, and it would be great if the docs can cover that as an example as well

🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)

No response

@sarah11918 sarah11918 added improve documentation Enhance existing documentation (e.g. add an example, improve description) good first issue Good for newcomers help - confirm behaviour Walk through the example/issue and confirm this is a general behaviour, or a correct update to make. help wanted Issues looking for someone to run with them! labels Jul 11, 2024
@Fryuni
Copy link
Member

Fryuni commented Jul 13, 2024

Relying on Git history on CI platforms is a bit problematic. We document this on Starlight's lastUpdated option since it is affected by it.

I wrote about the specific case of Vercel, but the same applies to GH actions. The actions/checkout action that does the cloning defaults to a fetch depth of 1.

Maybe something like the Starlight docs would be good here, but I don't think it should have anything specific to any platform. This problem happens to almost all of them, and each has a different way to opt out of that behavior when they even have that option.

@sarah11918
Copy link
Member Author

When you say "maybe something like", do you mean adding the text about "this may not be accurate?", or do you mean trying to write the recipe "in the way that Starlight does it"?

@Fryuni
Copy link
Member

Fryuni commented Jul 16, 2024

Adding this or something similar in the recipe:

Reporting the Git time may not be accurate depending on the environment in which the project is being built. Hosting platforms, CIs, and automated testing platforms commonly don't retrieve the full git history required for Git to return the correct values.

@sarah11918 sarah11918 modified the milestone: 4.12.0 Jul 17, 2024
@sarah11918
Copy link
Member Author

Gotcha! Would accept a PR to this recipe that adds this after the introduction, just before the recipe starts, in a note:

:::note[Relying on Git history]
By default, this feature relies on your repository’s Git history and may not be accurate on some deployment platforms performing [shallow clones](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthltdepthgt).
:::

@sarah11918 sarah11918 removed the help - confirm behaviour Walk through the example/issue and confirm this is a general behaviour, or a correct update to make. label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Issues looking for someone to run with them! improve documentation Enhance existing documentation (e.g. add an example, improve description)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants