Skip to content

Commit 7e63d4b

Browse files
committed
🐛 Use allowed-failures and skips equally
Before this patch, `allowed-failures` did not contribute to the overall computed outcome due to a bug in the checking logic. This change refactors the data strucutures used to simplify the check and reduce its complexity in general. Fixes #23
1 parent a638d64 commit 7e63d4b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/normalize_needed_jobs_status.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,17 @@ def main(argv: list[str]) -> int:
185185
)
186186
return 1
187187

188+
allowed_outcome_map = {}
189+
for job_name in jobs:
190+
allowed_outcome_map[job_name] = {'success'}
191+
if job_name in jobs_allowed_to_be_skipped:
192+
allowed_outcome_map[job_name].add('skipped')
193+
if job_name in jobs_allowed_to_fail:
194+
allowed_outcome_map[job_name].add('failure')
195+
188196
job_matrix_succeeded = all(
189-
job['result'] == 'success'
197+
job['result'] in allowed_outcome_map[name]
190198
for name, job in jobs.items()
191-
if name not in (jobs_allowed_to_fail | jobs_allowed_to_be_skipped)
192-
) and all(
193-
job['result'] in {'skipped', 'success'}
194-
for name, job in jobs.items()
195-
if name in jobs_allowed_to_be_skipped
196199
)
197200
set_final_result_outputs(job_matrix_succeeded)
198201

0 commit comments

Comments
 (0)