File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,7 +161,9 @@ function get_tar_relpath {
161161function update_apt_lists_if_stale {
162162 # Only check for stale package lists when running in nektos/act
163163 # GitHub Actions runners have fresh package lists, so skip this overhead
164- if [ " ${ACT} " = " true" ]; then
164+ # ACT comes from the environment
165+ # shellcheck disable=SC2154
166+ if [[ " ${ACT} " = " true" ]]; then
165167 if [[ -z " $( find -H /var/lib/apt/lists -maxdepth 0 -mmin -5 2> /dev/null) " ]]; then
166168 log " APT package lists are stale, updating..."
167169 if command -v apt-fast > /dev/null 2>&1 ; then
@@ -213,7 +215,7 @@ function write_manifest {
213215 else
214216 log " Writing ${1} packages manifest to ${3} ..."
215217 # 0:-1 to remove trailing comma, delimit by newline and sort.
216- echo " ${2: 0:- 1} " | tr ' ,' ' \n' | sort > " ${3} "
218+ echo " ${2: 0:- 1} " | tr ' ,' ' \n' > " ${3} "
217219 log " done"
218220 fi
219221}
Original file line number Diff line number Diff line change @@ -42,14 +42,15 @@ log "done"
4242log_empty_line
4343
4444# Only search for archived results. Manifest and cache key also live here.
45- # Use find instead of ls to better handle non-alphanumeric filenames
46- cached_filepaths=$( find " ${cache_dir} " -maxdepth 1 -name " *.tar" -type f 2> /dev/null | sort)
47- cached_filecount=$( echo " ${cached_filepaths} " | wc -w)
45+ manifest_all=" ${cache_dir} /manifest_all.log"
46+ mapfile -t packages < " ${manifest_all} "
4847
48+ cached_filecount=" ${# packages[@]} "
4949log " Restoring ${cached_filecount} packages from cache..."
50- for cached_filepath in ${cached_filepaths} ; do
5150
52- log " - $( basename " ${cached_filepath} " ) restoring..."
51+ for package in " ${packages[@]} " ; do
52+ cached_filepath=" ${cache_dir} /${package} .tar"
53+ log " - ${package} restoring..."
5354 sudo tar -xf " ${cached_filepath} " -C " ${cache_restore_root} " > /dev/null
5455 log " done"
5556
You can’t perform that action at this time.
0 commit comments