From 95e79124eb91a3cbb847c251dd1a73de38bc16d8 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 27 Sep 2013 15:55:46 +0800 Subject: [PATCH] Do not publish release when body of release note is empty. --- script/upload.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/script/upload.py b/script/upload.py index 8e89879..d5ee20b 100755 --- a/script/upload.py +++ b/script/upload.py @@ -72,9 +72,10 @@ def dist_newer_than_head(): return dist_time > int(head_time) -def get_text_with_editor(): - editor = os.environ.get('EDITOR','nano') - initial_message = '\n# Please enter the body of your release note.' +def get_text_with_editor(name): + editor = os.environ.get('EDITOR', 'nano') + initial_message = '\n# Please enter the body of your release note for %s.' \ + % name t = tempfile.NamedTemporaryFile(suffix='.tmp', delete=False) t.write(initial_message) @@ -102,8 +103,10 @@ def create_or_get_release_draft(github, tag): def create_release_draft(github, tag): name = 'atom-shell %s' % tag - body = get_text_with_editor() - print body + body = get_text_with_editor(name) + if body == '': + sys.stderr.write('Quit due to empty release note.\n') + sys.exit(0) data = dict(tag_name=tag, target_commitish=tag, name=name, body=body, draft=True) -- 2.7.4