@@ -22,19 +22,22 @@ jobs:
2222 steps :
2323 - name : Checkout
2424 uses : actions/checkout@v4
25+ with :
26+ fetch-depth : 1
2527
2628 - name : Checkout tutorials repo
2729 uses : actions/checkout@v4
2830 with :
2931 repository : AdvancedPhotonSource/GSAS-II-tutorials
3032 path : _docs
3133 ref : main
34+ fetch-depth : 1
3235
3336 - name : Compare files
3437 id : compare
3538 run : |
36- # Check if any .md files in _docs/MDhelp/docs are newer than GSASII/help
37- # Only compare markdown source files, not directory metadata
39+ # Check if any .md files in _docs/MDhelp/docs are newer than .html files in GSASII/help
40+ # Compare using filesystem modification times rather than git history
3841 files_changed="false"
3942
4043 if [ ! -d "GSASII/help" ]; then
@@ -44,28 +47,35 @@ jobs:
4447 echo "docs directory does not exist"
4548 files_changed="false"
4649 else
47- # Get the most recent commit date for .md files in docs directory
48- docs_latest =$(cd _docs && git ls-tree --name-only -r HEAD -- MDhelp/docs | grep '\ .md$' | while read filename; do echo "$(git log -1 --format="%ai" -- "$filename") $filename"; done | sort -r | head -1 | cut -d' ' -f1-3 )
50+ # Get the newest .md file in the docs directory
51+ docs_newest =$(find _docs/ MDhelp/docs -name "* .md" -type f -printf '%T@ %p\n' 2>/dev/null | sort -rn | head -1)
4952
50- # Get the most recent commit date for the help directory
51- help_latest =$(git ls-tree --name-only -r HEAD -- GSASII/help | while read filename; do echo "$(git log -1 --format="%ai" -- "$filename") $filename"; done | sort -r | head -1 | cut -d' ' -f1-3 )
53+ # Get the newest .html file in the help directory
54+ help_newest =$(find GSASII/help -name "*.html" -type f -printf '%T@ %p\n' 2>/dev/null | sort -rn | head -1)
5255
53- if [ -z "$docs_latest " ]; then
54- echo "Could not get commit date for markdown files in docs directory"
56+ if [ -z "$docs_newest " ]; then
57+ echo "No markdown files found in docs directory"
5558 files_changed="false"
56- elif [ -z "$help_latest " ]; then
57- echo "help directory has no commit history , will build"
59+ elif [ -z "$help_newest " ]; then
60+ echo "No HTML files in help directory , will build"
5861 files_changed="true"
5962 else
60- # Convert dates to epoch seconds for reliable numeric comparison
61- docs_epoch=$(date -d "$docs_latest" +%s 2>/dev/null || echo 0)
62- help_epoch=$(date -d "$help_latest" +%s 2>/dev/null || echo 0)
63+ # Extract timestamps (epoch seconds with decimal)
64+ docs_time=$(echo "$docs_newest" | cut -d' ' -f1)
65+ help_time=$(echo "$help_newest" | cut -d' ' -f1)
66+ docs_file=$(echo "$docs_newest" | cut -d' ' -f2-)
67+ help_file=$(echo "$help_newest" | cut -d' ' -f2-)
6368
64- if [ "$docs_epoch" -gt "$help_epoch" ]; then
65- echo "Markdown docs are newer (docs: $docs_latest, help: $help_latest)"
69+ # Compare timestamps (using awk for floating point comparison)
70+ if awk "BEGIN {exit !($docs_time > $help_time)}"; then
71+ echo "Markdown docs are newer"
72+ echo " Newest .md file: $docs_file ($(date -d @${docs_time%.*} '+%Y-%m-%d %H:%M:%S'))"
73+ echo " Newest .html file: $help_file ($(date -d @${help_time%.*} '+%Y-%m-%d %H:%M:%S'))"
6674 files_changed="true"
6775 else
68- echo "help directory is current (docs: $docs_latest, help: $help_latest)"
76+ echo "Help directory is current"
77+ echo " Newest .md file: $docs_file ($(date -d @${docs_time%.*} '+%Y-%m-%d %H:%M:%S'))"
78+ echo " Newest .html file: $help_file ($(date -d @${help_time%.*} '+%Y-%m-%d %H:%M:%S'))"
6979 files_changed="false"
7080 fi
7181 fi
8292
8393 - name : Checkout
8494 uses : actions/checkout@v4
95+ with :
96+ fetch-depth : 1
8597
8698 - name : Checkout
8799 # get the help pages from GSAS-II docs repo
90102 repository : AdvancedPhotonSource/GSAS-II-tutorials
91103 path : _docs
92104 ref : main
105+ fetch-depth : 1
93106
94107 - name : Python setup
95108 uses : actions/setup-python@v3
0 commit comments