Skip to content

Commit 8bb7904

Browse files
committed
more CoPilot fixes for help html gen workflow
1 parent 564c338 commit 8bb7904

1 file changed

Lines changed: 21 additions & 31 deletions

File tree

.github/workflows/update_help.yml

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ 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
37+
# Since mkdocs converts all MD files to HTML, compare the most recent commit
38+
# date in each directory
3839
files_changed="false"
3940
4041
if [ ! -d "GSASII/help" ]; then
@@ -44,39 +45,28 @@ jobs:
4445
echo "docs directory does not exist"
4546
files_changed="false"
4647
else
47-
# Compare git commit dates for files
48-
for doc_file in $(find _docs/MDhelp/docs -type f); do
49-
relative_path="${doc_file#_docs/MDhelp/docs/}"
50-
help_file="GSASII/help/$relative_path"
51-
52-
if [ ! -f "$help_file" ]; then
53-
echo "New file detected: $relative_path"
54-
files_changed="true"
55-
break
56-
fi
57-
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-
48+
# Get the most recent commit date for the docs directory
49+
docs_latest=$(cd _docs && git log -1 --format=%cI -- "MDhelp/docs/" 2>/dev/null || echo "")
50+
51+
# Get the most recent commit date for the help directory
52+
help_latest=$(git log -1 --format=%cI -- "GSASII/help/" 2>/dev/null || echo "")
53+
54+
if [ -z "$docs_latest" ]; then
55+
echo "Could not get commit date for docs directory"
56+
files_changed="false"
57+
elif [ -z "$help_latest" ]; then
58+
echo "help directory has no commit history, will build"
59+
files_changed="true"
60+
else
7361
# 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)"
62+
if [ "$docs_latest" > "$help_latest" ]; then
63+
echo "Docs directory is newer (docs: $docs_latest, help: $help_latest)"
7664
files_changed="true"
77-
break
65+
else
66+
echo "help directory is current (docs: $docs_latest, help: $help_latest)"
67+
files_changed="false"
7868
fi
79-
done
69+
fi
8070
fi
8171
8272
echo "files_changed=$files_changed" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)