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

Publish markdown files to readme.com with updatedAt values based on the git timestamps #18437

Closed
chrisjrn opened this issue Mar 7, 2023 · 9 comments

Comments

@chrisjrn
Copy link
Contributor

chrisjrn commented Mar 7, 2023

Currently, updating updatedAt values is a manual task, often overlooked by people updating the docs. This makes the docs appear more stale than they actually are (#18436).

With adhoc_tool support, it should be possible to create a Pants-managed workflow to publish docs to readme.com.

We should be able to write a tool to update the front matter of the docs to have a correct updatedAt value based on the mtime of the files, and then publish the post-processed files using the rdme node.js-based tool.

@benjyw benjyw changed the title Publish markdown files to readme.com with updatedAt values based on the files' mtimes Publish markdown files to readme.com with updatedAt values based on the git timestamps Mar 11, 2023
@benjyw
Copy link
Sponsor Contributor

benjyw commented Mar 11, 2023

The git timestamps are a more accurate representation of the creation/update times that the mtimes. For example, when cloning a repo all the mtimes will be now-ish.

@jsirois
Copy link
Member

jsirois commented Mar 11, 2023

Assuming readme.com is not lying here, they dogfood a GitHub action - no Pants tooling required: https://docs.readme.com/main/docs/rdme

I'd hope their dogfood includes bumping updated at, but it seems easy enough to find out.

@benjyw
Copy link
Sponsor Contributor

benjyw commented Mar 11, 2023

I looked at that action and as far as I can tell it just installs and runs the rdme client for you, and does no updating of updatedAt.

@benjyw
Copy link
Sponsor Contributor

benjyw commented Mar 11, 2023

Oh, but, can also confirm that the rdme client does the right thing on upload. The change isn't reflected in the source of course, but it looks like it is on the server:

Screenshot 2023-03-11 at 11 59 16 AM

(I synced the file 15 minutes ago, but its updatedAt in the source is older)

@benjyw
Copy link
Sponsor Contributor

benjyw commented Mar 11, 2023

Can also confirm that this all still works if we delete updatedAt entirely. So I will do that.

@benjyw
Copy link
Sponsor Contributor

benjyw commented Mar 11, 2023

OK, it's a little more complicated than that. If updatedAt exists, it is used to set that user-visible "last updated" text.

If it doesn't exist, the current time at sync is used, but only if the body has changed (changing the front matter doesn't affect the updated time, even though it will cause rdme to sync the file). So simply deleting updatedAt will freeze the user-visible last updated time at whatever it was in the file before we deleted it, until that file's body is next updated.

So what we actually want to do to get correct user-visible last updated times is to set the updatedAt time based on the most recent git timestamp, sync, and then delete the field.

@benjyw
Copy link
Sponsor Contributor

benjyw commented Mar 12, 2023

#18475

(I temporarily set the updatedAt time for that one-time sync, and synced to 2.16.x, so there is no need to check that in).

@cburroughs
Copy link
Contributor

Is this still relevant with the new docs site?

@benjyw
Copy link
Sponsor Contributor

benjyw commented Apr 20, 2024

Is this still relevant with the new docs site?

Nope, I'll close this. Thanks!

@benjyw benjyw closed this as completed Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants