get emails for sending people info about warnings
diff --git a/configure.py b/configure.py
old mode 100755
new mode 100644
index 226a399..ea550fa
--- a/configure.py
+++ b/configure.py
@@ -44,6 +44,13 @@
if not os.path.exists(project_dir):
os.makedirs(project_dir)
+ # useful for contacting people when I find problems in the repo
+ try:
+ with open('git_url_to_email.json') as fh:
+ self.git_url_to_email_map = json.load(fh)
+ except FileNotFoundError:
+ self.git_url_to_email_map = {}
+
self.projects = []
filler = False
filler_id = 0
@@ -61,7 +68,12 @@
filler_id = 0 # first project is always fill
filler = True
- project = Project(index, git_url, project_dir, fill=filler, fill_id=filler_id)
+ try:
+ email = self.git_url_to_email_map[git_url]
+ except KeyError:
+ email = 'none'
+
+ project = Project(index, git_url, email, args, project_dir, fill=filler, fill_id=filler_id)
# clone git repos locally & gds artifacts from action build
if args.clone_all:
@@ -85,6 +97,8 @@
# fill projects will load from the fill project's directory
project.load_yaml()
+ logging.info(project)
+
if args.harden:
if filler is False:
project.harden()
@@ -119,8 +133,10 @@
class Project():
- def __init__(self, index, git_url, project_dir, fill, fill_id=0):
+ def __init__(self, index, git_url, email, args, project_dir, fill, fill_id=0):
self.git_url = git_url
+ self.args = args
+ self.email = email
self.index = index
self.fill = fill
self.project_dir = project_dir
@@ -255,7 +271,7 @@
exit(1)
else:
logging.info("clone")
- git.Repo.clone_from(self.git_url, self.local_dir, recursive=True)
+ git.Repo.clone_from(self.git_url, self.local_dir)
def pull(self):
repo = git.Repo(self.local_dir)
@@ -294,7 +310,10 @@
os.chdir(cwd)
def __str__(self):
- return f"[{self.index:03} : {self.git_url}]"
+ if self.args.log_email:
+ return f"[{self.index:03} : {self.email} : {self.git_url}]"
+ else:
+ return f"[{self.index:03} : {self.git_url}]"
def fetch_gds(self):
install_artifacts(self.git_url, self.local_dir)
@@ -736,6 +755,7 @@
parser.add_argument('--limit-num-projects', help='only configure for the first n projects', type=int, default=DEFAULT_NUM_PROJECTS)
parser.add_argument('--test', help='use test projects', action='store_const', const=True)
parser.add_argument('--debug', help="debug logging", action="store_const", dest="loglevel", const=logging.DEBUG, default=logging.INFO)
+ parser.add_argument('--log-email', help="print persons email in messages", action="store_const", const=True)
parser.add_argument('--update-image', help="update the image", action="store_const", const=True)
parser.add_argument('--dump-json', help="dump json of all project data to given file")
parser.add_argument('--dump-markdown', help="dump markdown of all project data to given file")
diff --git a/update_urls.py b/update_urls.py
old mode 100755
new mode 100644
index 5e49687..56cb27d
--- a/update_urls.py
+++ b/update_urls.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-import stripe, os
+import stripe, os, json
stripe.api_key = os.environ['STRIPE_TOKEN']
start_id = "cs_live_b1yJQBXmWxKQKPL4z8P6FDeKvRTW05KOIG8ZBkvod2YRCe5vkxFybIHttA"
@@ -11,7 +11,7 @@
open_date = datetime(2022, 11, 8)
start_id = None
after_open_date = True
-
+git_url_to_email_map = {}
while after_open_date:
checkouts = stripe.checkout.Session.list(limit=10, starting_after=start_id)
@@ -22,9 +22,10 @@
if checkout['payment_status'] == 'paid':
if 'github' in checkout['metadata']:
- print(f"{created} : {checkout['metadata']['github']}")
- git_urls.append(checkout['metadata']['github'])
-
+ git_url = checkout['metadata']['github']
+ print(f"{created} : {git_url}")
+ git_urls.append(git_url)
+ git_url_to_email_map[git_url] = checkout['customer_details']['email']
# pagination
start_id = checkout['id']
@@ -38,4 +39,7 @@
fh.write(" ]\n")
+with open('git_url_to_email.json', 'w') as fh:
+ fh.write(json.dumps(git_url_to_email_map))
+
print(f"created project_urls.py with {len(git_urls)} projects")