Skip to content

Commit addf2d1

Browse files
committed
Add ignore for the initial commit where all the modified dates were batch updated
1 parent 58f5a35 commit addf2d1

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

docs/tutorials/mbot-cli-tool.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
layout: single
33
title: MBot Command Line Tool
44
toc: true
5+
last_modified_at: 2024-10-22
56
---
67

78
> This guide provides an overview of all command line tools in the MBot ecosystem.
@@ -134,4 +135,5 @@ When you are looking for the answers to:
134135
- `mbot lcm-msg list`
135136
136137
### Demo
137-
<iframe width="560" height="315" src="https://www.youtube.com/embed/zSHahiZNv_A?si=GBOBaFaTz3UKvp6r" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
138+
<iframe width="560" height="315" src="https://www.youtube.com/embed/zSHahiZNv_A?si=GBOBaFaTz3UKvp6r" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
139+

scripts/update_last_modified.sh

+17-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,26 @@
44

55
# Define the directory containing the Markdown files
66
DOCS_DIR="docs"
7+
# This is a small hack to ignore the initial commit where all the last modified dates were updated.
8+
IGNORE_COMMIT=172d7a
9+
10+
# Function to get the last relevant commit date
11+
get_last_relevant_commit_date() {
12+
local file=$1
13+
# Iterate through commits until a relevant one is found
14+
git log --format="%H %ci" -- "$file" | while read -r hash date time tz; do
15+
16+
if [[ $hash != $IGNORE_COMMIT* ]]; then
17+
echo "$date"
18+
break
19+
fi
20+
done
21+
}
722

823
# Loop through all Markdown files recursively in the directory and its subdirectories
924
find "$DOCS_DIR" -type f -name "*.md" | while read -r file; do
10-
# Get the last commit date of the file in "YYYY-MM-DD" format
11-
last_modified_date=$(git log -1 --format="%ci" -- "$file" | cut -d ' ' -f 1)
25+
# Get the last relevant commit date of the file in "YYYY-MM-DD" format
26+
last_modified_date=$(get_last_relevant_commit_date "$file")
1227

1328
# Use awk to process the frontmatter and determine if an update is needed
1429
needs_update=$(awk -v date="$last_modified_date" '

0 commit comments

Comments
 (0)