stubsabot: checkout the branch you were on after script completion (#8742)

This commit is contained in:
Alex Waygood
2022-09-18 12:52:03 +01:00
committed by GitHub
parent 9b306c3367
commit 2eaa63b8fa

View File

@@ -483,6 +483,10 @@ async def main() -> None:
denylist = {"gdb"} # gdb is not a pypi distribution
original_branch = subprocess.run(
["git", "branch", "--show-current"], text=True, capture_output=True, check=True
).stdout.strip()
if args.action_level >= ActionLevel.fork:
subprocess.check_call(["git", "fetch", "--prune", "--all"])
@@ -523,7 +527,7 @@ async def main() -> None:
# if you need to cleanup, try:
# git branch -D $(git branch --list 'stubsabot/*')
if args.action_level >= ActionLevel.local:
subprocess.check_call(["git", "checkout", "master"])
subprocess.check_call(["git", "checkout", original_branch])
if __name__ == "__main__":