Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions bes_dev_kit/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json
import sys
from sys import platform
import time
from typing import Optional
from typing import List
from rich import print
Expand Down Expand Up @@ -58,6 +59,13 @@ def prompt_user(key, value):
break
return value

def check_path(path) :
if ((path.endswith('besecure-assets-store')
or path.endswith('besecure-assessment-datastore'))
and os.path.exists(path)
) : return False
else : return True

def check_if_value_empty():
"""Checks if any env var is empty. Calls function prompt_user if empty
"""
Expand All @@ -67,11 +75,11 @@ def check_if_value_empty():
with open(vars_file_path, 'r+', encoding="utf-8") as file_pointer:
env_vars = json.load(file_pointer)
for key, value in env_vars.items():

if value == "":
if value == "" or (key != 'GITHUB_AUTH_TOKEN' and key != 'GITHUB_ORG' and check_path(value)) :
new_value = prompt_user(key, value)
env_vars[key] = new_value
file_pointer.seek(0)
file_pointer.truncate()
file_pointer.write(json.dumps(env_vars, indent=4))

def set_env_vars():
Expand Down
1 change: 1 addition & 0 deletions bes_dev_kit/src/generate_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def fetch_report(self, url):
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
print(exc_type, fname, exc_tb.tb_lineno)
print("[bold red]Please configure scorecard action in GitHub workflow")
sys.exit(str(err))
data = json.loads(raw_data.read())

Expand Down