[devops] Improve check for crash reports before collecting them. (#15938)

Otherwise this happens if the directory is empty:

    + test -d /Users/runner/Library/Logs/DiagnosticReports
    + zip -9rj /Users/runner/work/1/s/crash-reports.zip /Users/runner/Library/Logs/DiagnosticReports

    zip error: Nothing to do! (try: zip -9rj /Users/runner/work/1/s/crash-reports.zip . -i /Users/runner/Library/Logs/DiagnosticReports)
This commit is contained in:
Rolf Bjarne Kvinge 2022-09-15 11:58:35 +02:00 коммит произвёл GitHub
Родитель 2d0c1c5462
Коммит 1f3fb41d63
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -2,7 +2,9 @@
env | sort
if test -d "$HOME/Library/Logs/DiagnosticReports"; then
if ! test -d "$HOME/Library/Logs/DiagnosticReports"; then
true # directory doesn't exist: nothing to do
elif test -n "$(ls -A $HOME/Library/Logs/DiagnosticReports)"; then
zip -9rj "$SYSTEM_DEFAULTWORKINGDIRECTORY/crash-reports.zip" "$HOME/Library/Logs/DiagnosticReports"
if test -f "$SYSTEM_DEFAULTWORKINGDIRECTORY/crash-reports.zip"; then
set +x