Skip to content

Commit 564c338

Browse files
committed
CoPilot fixes for help html gen workflow
1 parent 2a34a5b commit 564c338

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

.github/workflows/update_help.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
id: compare
3535
run: |
3636
# Check if any files in _docs/MDhelp/docs are newer than GSASII/help
37+
# Use git log to get actual modification dates from commit history
3738
files_changed="false"
3839
3940
if [ ! -d "GSASII/help" ]; then
@@ -43,7 +44,7 @@ jobs:
4344
echo "docs directory does not exist"
4445
files_changed="false"
4546
else
46-
# Compare modification times of files
47+
# Compare git commit dates for files
4748
for doc_file in $(find _docs/MDhelp/docs -type f); do
4849
relative_path="${doc_file#_docs/MDhelp/docs/}"
4950
help_file="GSASII/help/$relative_path"
@@ -54,9 +55,24 @@ jobs:
5455
break
5556
fi
5657
57-
# Compare modification times
58-
if [ "$doc_file" -nt "$help_file" ]; then
59-
echo "File is newer: $relative_path"
58+
# Get git commit dates using git log
59+
doc_commit_date=$(cd _docs && git log -1 --format=%cI -- "MDhelp/docs/$relative_path" 2>/dev/null || echo "")
60+
help_commit_date=$(git log -1 --format=%cI -- "GSASII/help/$relative_path" 2>/dev/null || echo "")
61+
62+
if [ -z "$doc_commit_date" ]; then
63+
echo "Could not get commit date for: $relative_path"
64+
continue
65+
fi
66+
67+
if [ -z "$help_commit_date" ]; then
68+
echo "New file detected: $relative_path"
69+
files_changed="true"
70+
break
71+
fi
72+
73+
# Compare ISO 8601 dates (they sort correctly as strings)
74+
if [ "$doc_commit_date" > "$help_commit_date" ]; then
75+
echo "File is newer in tutorials repo: $relative_path (docs: $doc_commit_date, help: $help_commit_date)"
6076
files_changed="true"
6177
break
6278
fi

0 commit comments

Comments
 (0)