Skip to content

Commit

Permalink
add excluded runs logic to df.py
Browse files Browse the repository at this point in the history
  • Loading branch information
richgreen-moj committed May 24, 2024
1 parent e2d4e2a commit cda8db9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions df.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# Initialize variables
runs = []
per_page = 100
num_excluded_runs = 0

date_format = "%Y-%m-%dT%H:%M:%SZ"

Expand All @@ -42,7 +43,9 @@

# load the repository names from a JSON file
with open(args.filename, "r") as f:
repos = json.load(f)["repos"]
data = json.load(f)
repos = data['repos']
excluded_workflows = data['excluded_workflows']

num_successful_runs = 0

Expand All @@ -60,7 +63,12 @@
# Log message if there's a problem retrieving the workflow runs
print(f"Error retrieving workflow runs: {e}")

num_successful_runs = len(runs)
# Calculate number of successful runs (minus the excluded runs)
num_runs = len(runs)
num_excluded_runs += len(
[run for run in runs if run["name"] in excluded_workflows]
)
num_successful_runs = (num_runs - num_excluded_runs)

# Compute the number of days between the earliest and latest successful runs
if num_successful_runs > 0:
Expand Down

0 comments on commit cda8db9

Please sign in to comment.