Skip to content

Commit

Permalink
added fallaback to look for secrets/gh_keyfile.json
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsadler-branch committed Aug 11, 2022
1 parent 963a144 commit b7547dc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion py-github-helper/utils/custom_arg_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def parse_args(argv):
)

args = parser.parse_args()
validate_args(args)
args = validate_args(args)

parameters = {**vars(args), **json.loads(args.extras)}
pretty_params = "\n".join(
Expand Down
5 changes: 4 additions & 1 deletion py-github-helper/utils/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import json
import re


base_url = "https://api.github.com"

available_commands = {
Expand Down Expand Up @@ -146,11 +145,15 @@ def validate_args(args):
raise ValueError(
"ERROR:\tOnly one form of authentication is required (either token or user/pass)."
)
if not args.token and not args.username:
with open("secrets/gh_keyfile.json", "r") as gh_keyfile:
args.token = gh_keyfile.read()

if not is_json(args.extras):
raise ValueError(
f'\n\nERROR:\tParamater "extras" is not formatted correctly. Incorrect syntax:\n\t{args.extras}'
)
return args


def parse_message_for_prs(message):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path


VERSION = '0.1.10'
VERSION = '0.1.11'
DESCRIPTION = 'Python Script for interacting with Github API'
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
Expand Down

0 comments on commit b7547dc

Please sign in to comment.