File: purge-PRs.py

package info (click to toggle)
powerline 2.7-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,828 kB
  • sloc: python: 22,536; sh: 1,789; ansic: 131; makefile: 74; csh: 51
file content (27 lines) | stat: -rwxr-xr-x 965 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)

import argparse

from getpass import getpass

from github import Github


p = argparse.ArgumentParser(description='Powerline release script')
p.add_argument('-u', '--user', type=str, metavar='USER', help='Github username.', required=True)
p.add_argument('-p', '--password', type=str, metavar='PASS', help='Github password. You will be prompted if it is not supplied.')

if __name__ == '__main__':
	args = p.parse_args()
	user = args.user
	password = args.password or getpass('Password for {0}: '.format(user))
	gh = Github(user, password)
	grepo = gh.get_repo('powerline/powerline')
	for pr in grepo.get_pulls():
		if pr.base.ref != 'develop':
			issue = grepo.get_issue(pr.number)
			issue.create_comment('PRs to any branch, but develop, are not accepted.', )
			issue.add_to_labels('s:invalid')
			issue.edit(state='closed')