File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,19 +10,30 @@ if [ "$#" -lt 1 ]; then
1010 exit 1
1111fi
1212
13+ epoch_grep () {
14+ grep -E ' ^[[:space:]]+epoch:'
15+ }
16+
17+ epoch_sed () {
18+ sed -r ' s/^[[:space:]]+epoch:[[:space:]]+([0-9])+/\1/'
19+ }
20+
1321for yaml_file in " $@ " ; do
1422 echo " Checking $yaml_file :"
1523
1624 # Extract the epoch from the current file using grep and sed
17- epoch_local=$( grep -E ' ^[[:space:]]*epoch:' " $yaml_file " | sed ' s/.*epoch:[[:space:]]*//' )
25+ # (not assuming `yq` is available)
26+ epoch_line=" $( epoch_grep < " $yaml_file " ) "
27+ epoch_local=" $( echo " $epoch_line " | epoch_sed) "
1828 if [ -z " $epoch_local " ]; then
1929 echo " Warning: 'epoch' field not found in $yaml_file "
2030 echo " "
2131 continue
2232 fi
2333
2434 # Extract the epoch from the file on the main branch using git show
25- epoch_main=$( git show main:" $yaml_file " 2> /dev/null | grep -E ' ^[[:space:]]*epoch:' | sed ' s/.*epoch:[[:space:]]*//' )
35+ epoch_main_line=" $( git show main:" $yaml_file " 2> /dev/null | epoch_grep) "
36+ epoch_main=" $( echo " $epoch_main_line " | epoch_sed) "
2637 if [ -z " $epoch_main " ]; then
2738 echo " Warning: 'epoch' field not found in $yaml_file on branch 'main'"
2839 echo " "
You can’t perform that action at this time.
0 commit comments