Review this generated Bash script against its stated task before it runs in CI.
Create one archive from CSV files under an allowlisted report directory, preserve filenames exactly, create a valid empty archive when no files match, and leave source data unchanged.
Shell
#!/usr/bin/env bash
set -e
report_dir=$1
archive=$2
files=""
for file in $(find $report_dir -type f -name '*.csv'); do
files="$files $file"
done
if [ -z "$files" ]; then
echo "no reports"
exit 0
fi
tar -czf $archive $files
echo "created $archive"
cache_dir="$report_dir/cache"
rm -rf "$cache_dir"/*
echo "cache cleared"
generated code is illustrative, not from any one model