From 4a718cb076ae49800a2a968b5bb8fffb1ae5c32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Sun, 24 May 2020 15:18:08 +0100 Subject: [PATCH] fix(ci): don't post diff comments when there's no content --- scripts/cra-bundle-stats-diff.py | 3 ++- scripts/pr-comment.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/cra-bundle-stats-diff.py b/scripts/cra-bundle-stats-diff.py index 67d6f9ada..a4b224588 100755 --- a/scripts/cra-bundle-stats-diff.py +++ b/scripts/cra-bundle-stats-diff.py @@ -224,4 +224,5 @@ if __name__ == '__main__': sys.exit(1) diffs = diffBundles(bundleA, bundleB) - printDiff(diffs) + if diffs: + printDiff(diffs) diff --git a/scripts/pr-comment.py b/scripts/pr-comment.py index 99107cf8d..4905eec86 100755 --- a/scripts/pr-comment.py +++ b/scripts/pr-comment.py @@ -82,6 +82,10 @@ if __name__ == '__main__': with open(commentFile) as f: comment = f.read() + if not comment: + print('{path} is empty, exiting'.format(path=commentFile)) + sys.exit(0) + if format == 'noformat': comment = '```\n{body}\n```'.format(body=comment)