north-star / commit
ci pasta!
scripts/clean-old-firebase.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/clean-old-firebase.sh b/scripts/clean-old-firebase.sh index 31ced34..29f6101 100755 --- a/scripts/clean-old-firebase.sh +++ b/scripts/clean-old-firebase.sh @@ -41,12 +41,13 @@ sanitize_firebase_json_output() { local clean clean=$(printf '%s\n' "$raw" | sed -E 's/\x1B\[[0-9;]*[A-Za-z]//g' | sed '/^[[:space:]]*$/d') - # Some firebase-tools builds append a trailing {"status":"success"} object. - # Keep only the payload emitted before that footer. + # firebase-tools can print warnings before payload and/or append + # a trailing status object. Select only the first real payload line. + # Expected payload is compact JSON object or literal null. clean=$(printf '%s\n' "$clean" | awk ' - BEGIN { stop = 0 } - /^\{[[:space:]]*"status"[[:space:]]*:[[:space:]]*"success"/ { stop = 1 } - stop == 0 { print } + /^[[:space:]]*null[[:space:]]*$/ { print "null"; exit } + /^[[:space:]]*\{[[:space:]]*"status"[[:space:]]*:/ { next } + /^[[:space:]]*\{/ { print; exit } ') printf '%s' "$clean"