-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanage_milestones.py
39 lines (35 loc) · 1.61 KB
/
manage_milestones.py
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
28
29
30
31
32
33
34
35
36
37
38
39
import os
import logging
from ghorgs.managers import GithubOrganizationManager
logging.basicConfig(format='%(asctime) [%(level)s]: %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('-t', '--token',
default=os.environ.get('GITHUB_OAUTH_TOKEN', None),
help='GITHUB OAUTH Token')
parser.add_argument('-o', '--organization',
default='abeja-inc',
help='Github Organization Name')
parser.add_argument('-r', '--repository',
default=None,
help='Project Name Filter(s) [DEFAULT=None]')
parser.add_argument('--verbose',
action='store_true',
default=False,
help='If given, DEBUG info will be displayed')
subparsers = parser.add_subparsers()
milestone_parser = subparsers.add_parser('miletones')
milestone_parser.add_argument('-d', '--dump',
action='store_true',
default=False,
help='Dump MILESTONES for the given repoistory')
args = parser.parse_args()
if args.verbose:
logger.setLevel(logging.DEBUG)
manager = GithubOrganizationManager(args.organization,
args.token)
repository = next(manager.repositories(name=args.repository)) # should only be 1
print(repository.milestones)