Skip to content

Commit 889d34f

Browse files
author
Steven Silvester
authored
Merge pull request #79 from blink1073/handle-push-error
2 parents 79e0cb5 + e49adac commit 889d34f

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

meeseeksdev/meeseeksbox/commands.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def push_the_work(session, payload, arguments, local_config=None):
415415
print(f"pushing with workbranch:{branch}")
416416
succeeded = True
417417
try:
418-
repo.remotes.origin.push("workbranch:{}".format(branch), force=True)
418+
repo.remotes.origin.push("workbranch:{}".format(branch), force=True).raise_if_error()
419419
except Exception:
420420
succeeded = False
421421

@@ -943,25 +943,34 @@ def keen_stats():
943943

944944
# Push the backported work
945945
print("== Pushing work....:")
946+
succeeded = True
946947
try:
947948
print(f"Trying to push to {remote_submit_branch} of {session.personal_account_name}")
948949
repo.remotes[session.personal_account_name].push(
949950
"workbranch:{}".format(remote_submit_branch)
950-
)
951+
).raise_if_error()
951952
except Exception as e:
952953
import traceback
953954

954955
traceback.print_exc()
955956
print("could not push to self remote")
956957
s_reason = "Could not push"
957958
keen_stats()
958-
# TODO comment on issue
959+
960+
session.post_comment(
961+
comment_url, f"Could not push to {remote_submit_branch} due to error, aborting."
962+
)
959963
print(e)
964+
succeeded = False
965+
960966
repo.git.checkout(default_branch)
961967
repo.branches.workbranch.delete(repo, "workbranch", force=True)
962968

963969
# TODO checkout the default_branch and get rid of branch
964970

971+
if not succeeded:
972+
return
973+
965974
# Make the PR on GitHub
966975
print(
967976
"try to create PR with milestone",

0 commit comments

Comments
 (0)