release.py script changed to use gh auth login
for authentication
This commit is contained in:
parent
8209eafc6b
commit
b8867cd18c
1 changed files with 9 additions and 17 deletions
|
@ -2,7 +2,7 @@ import os
|
||||||
import re
|
import re
|
||||||
import io
|
import io
|
||||||
import sys
|
import sys
|
||||||
import json
|
import yaml
|
||||||
import argparse
|
import argparse
|
||||||
import unittest
|
import unittest
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
@ -25,25 +25,17 @@ AREA_RENAME = {
|
||||||
|
|
||||||
|
|
||||||
def get_github():
|
def get_github():
|
||||||
config_path = os.path.expanduser('~/.lbry-release-tool.json')
|
config_path = os.path.expanduser('~/.config/gh/hosts.yml')
|
||||||
if os.path.exists(config_path):
|
if os.path.exists(config_path):
|
||||||
with open(config_path, 'r') as config_file:
|
with open(config_path, 'r') as config_file:
|
||||||
config = json.load(config_file)
|
config = yaml.load(config_file, Loader=yaml.FullLoader)
|
||||||
return github3.login(token=config['token'])
|
return github3.login(token=config['github.com']['oauth_token'])
|
||||||
|
|
||||||
token = os.environ.get("GH_TOKEN")
|
print('To run release tool you need to first login using the github cli:')
|
||||||
if not token:
|
print('')
|
||||||
print('GitHub Credentials')
|
print(' $ gh auth login')
|
||||||
username = input('username: ')
|
print('')
|
||||||
password = getpass('password: ')
|
sys.exit(1)
|
||||||
gh = github3.authorize(
|
|
||||||
username, password, ['repo'], 'lbry release tool',
|
|
||||||
two_factor_callback=lambda: input('Enter 2FA: ')
|
|
||||||
)
|
|
||||||
with open(config_path, 'w') as config_file:
|
|
||||||
json.dump({'token': gh.token}, config_file)
|
|
||||||
token = gh.token
|
|
||||||
return github3.login(token=token)
|
|
||||||
|
|
||||||
|
|
||||||
def get_labels(pr, prefix):
|
def get_labels(pr, prefix):
|
||||||
|
|
Loading…
Reference in a new issue