Last active
February 5, 2020 17:14
-
-
Save theanalyst/210f60b621e0fd965f5033b150d736a2 to your computer and use it in GitHub Desktop.
change_base_branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# do a `pip install githubpy` before running the script | |
import os | |
import github | |
import argparse | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser() | |
parser.add_argument("target_sha", metavar="target_sha", | |
help="sha1 of the branch to update to") | |
token = os.getenv("GITHUB_ACCESS_TOKEN") | |
gh = github.GitHub(access_token=token) | |
args = parser.parse_args() | |
print(args.target_sha) | |
prs = gh.repos("ceph")("ceph").pulls.get(state="open", | |
base="nautilus") | |
for pr in prs: | |
if pr['base']['sha'] != args.target_sha: | |
print("Turning pr off & on again...", pr['number']) | |
gh.repos("ceph")("ceph").pulls(pr['number']).patch(base="nautilus-saved") | |
gh.repos("ceph")("ceph").pulls(pr['number']).patch(base="nautilus") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment