Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

Make function checkout back to master #174

Merged
merged 4 commits into from
Mar 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions release_bot/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,11 @@ def make_release_pr(self, new_pr):
name, email = self.get_user_contact()
repo.set_credentials(name, email)
repo.set_credential_store()
# The bot first checks out the master branch and from master
# it creates the new branch, checks out to it and then perform the release
# This makes sure that the new release_pr branch has all the commits
# from the master branch for the lastest release.
repo.checkout('master')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please elaborate why is this needed? Two lines below there is another checkout. Ideally please include a comment in the code.

changelog = repo.get_log_since_last_release(new_pr['previous_version'])
repo.checkout_new_branch(branch)
changed = look_for_version_files(repo.repo_path, new_pr['version'])
Expand All @@ -445,6 +450,8 @@ def make_release_pr(self, new_pr):
return True
except GitException as exc:
raise ReleaseException(exc)
finally:
repo.checkout('master')
return False

def pr_exists(self, name):
Expand Down
2 changes: 2 additions & 0 deletions release_bot/releasebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ def release_handler(success):
except ReleaseException:
release_handler(success=False)
raise
finally:
self.git.checkout('master')

return True

Expand Down