-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate_org_project.py
37 lines (32 loc) · 1.45 KB
/
create_org_project.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
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',
help='Github Organization Name',
required=True)
parser.add_argument('-n', '--name', type=str, help="project name", required=True)
parser.add_argument("-d", "--description", type=str, help="project description")
parser.add_argument('--verbose',
action='store_true',
default=False,
help='If given, DEBUG info will be displayed')
args = parser.parse_args()
if args.verbose:
logger.setLevel(logging.DEBUG)
if args.token:
manager = GithubOrganizationManager(args.organization, args.token)
else:
manager = GithubOrganizationManager(args.organization)
project_url, responses = manager.create_organizational_project(name=args.name, description=args.description)
logger.info(f'project_url={project_url}')
for r in responses:
logger.info(f"response={r}")