From ab488a2b4c457ce6cdd3901cd5e85c78184fff57 Mon Sep 17 00:00:00 2001 From: Dave North <6616703+dnorth98@users.noreply.github.com> Date: Mon, 1 Dec 2025 13:51:12 -0500 Subject: [PATCH 1/3] Handle ghost users - users who are no longer in the org --- get-deployment-metrics.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/get-deployment-metrics.py b/get-deployment-metrics.py index 322f70b..0164dfc 100755 --- a/get-deployment-metrics.py +++ b/get-deployment-metrics.py @@ -7,6 +7,7 @@ import fnmatch from agithub.GitHub import GitHub from dotenv import load_dotenv +from pprint import pprint def get_mins_secs_str(duration_in_ms): @@ -209,9 +210,14 @@ def get_workflow_runs(org_name, repo_name, workflow_id, date_filter): summary_stats[repo_name] = dict() for workflow_run in workflow_runs: + #logging.debug("NEW WORKFLOW RUN FOUND...") + #pprint(workflow_run) workflow_status = workflow_run["conclusion"] job_id = workflow_run["id"] - actor = workflow_run["triggering_actor"]["login"] + if workflow_run["triggering_actor"]: + actor = workflow_run["triggering_actor"]["login"] + else: + actor = "User is no longer in the org" logging.debug("Workflow run was triggered by {}".format(actor)) From efbceb997d0826306949941d529d979de40a36a2 Mon Sep 17 00:00:00 2001 From: Dave North <6616703+dnorth98@users.noreply.github.com> Date: Mon, 1 Dec 2025 13:53:14 -0500 Subject: [PATCH 2/3] Remove debug statements --- get-deployment-metrics.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/get-deployment-metrics.py b/get-deployment-metrics.py index 0164dfc..809eadd 100755 --- a/get-deployment-metrics.py +++ b/get-deployment-metrics.py @@ -7,8 +7,6 @@ import fnmatch from agithub.GitHub import GitHub from dotenv import load_dotenv -from pprint import pprint - def get_mins_secs_str(duration_in_ms): duration_secs, duration_in_ms = divmod(duration_in_ms, 1000) @@ -210,8 +208,6 @@ def get_workflow_runs(org_name, repo_name, workflow_id, date_filter): summary_stats[repo_name] = dict() for workflow_run in workflow_runs: - #logging.debug("NEW WORKFLOW RUN FOUND...") - #pprint(workflow_run) workflow_status = workflow_run["conclusion"] job_id = workflow_run["id"] if workflow_run["triggering_actor"]: From 772ccc1afb9033611d9cd8cde9cbad8e58bf6c5a Mon Sep 17 00:00:00 2001 From: Dave North <6616703+dnorth98@users.noreply.github.com> Date: Mon, 1 Dec 2025 13:57:35 -0500 Subject: [PATCH 3/3] formatting --- get-deployment-metrics.py | 1 + 1 file changed, 1 insertion(+) diff --git a/get-deployment-metrics.py b/get-deployment-metrics.py index 809eadd..bc1d62d 100755 --- a/get-deployment-metrics.py +++ b/get-deployment-metrics.py @@ -8,6 +8,7 @@ from agithub.GitHub import GitHub from dotenv import load_dotenv + def get_mins_secs_str(duration_in_ms): duration_secs, duration_in_ms = divmod(duration_in_ms, 1000) duration_mins, duration_secs = divmod(duration_secs, 60)