How to automatically generate a last_updated entry in docs
https://gitlab.com/gitlab-com/gitlab-docs/merge_requests/87 introduced a last updated entry at the end of the docs. In order for the last update to show in a document, you need to add the following in the yaml frontmatter:
last_updated: 2017-09-09
Creating a raketask that updates the value automatically based on latest git commit would be great! For ref: https://stackoverflow.com/questions/36948807/edit-yaml-frontmatter-in-markdown-file.
From a bit of a search:
Method 1
Find last updated time:
git log -1 --format=%cd --date=format:'%d %B %Y' $file
which results to a format:
27 April 2017
Method 2
Different method, if we want to use the iso format in yaml frontmatter and output in human readable format:
git log -1 --date=short --format=%cd $file
and then parse with Ruby:
require "time"
ut = DateTime.parse("2017-04-27")
ut.strftime("%-d %B %Y")
@rymai I'd appreciate any help here :)