Skip to content

Instantly share code, notes, and snippets.

@jillr
Last active July 2, 2020 13:43
Show Gist options
  • Save jillr/3ea18312c5cef54ef07c47e8a180de6c to your computer and use it in GitHub Desktop.
Save jillr/3ea18312c5cef54ef07c47e8a180de6c to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
#
# Simplified BSD License https://opensource.org/licenses/BSD-2-Clause)
#
from github import Github
g = Github("access_token")
repo = g.get_repo("ansible-collections/collection_name")
pulls = repo.get_pulls(state='open', base='master')
for pr in pulls:
pr.edit(base='main')
@felixfontein
Copy link

I can verify that it works as expected!

(If you have a PR for merging main into master, it will fail for that one. I had a WIP PR to see whether CI ran though. After skipping it if pr.number == XX: continue) it worked fine.)

You can add print('#{0} "{1}": merge {2} into "{3}"'.format(pr.number, pr.title, '{0}@{1}'.format(pr.head.repo.full_name, pr.head.ref), pr.base.ref)) before the pr.edit() call to see which PR is currently processed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment