Skip to content

Commit bd0610c

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 f0d456a commit bd0610c

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
@@ -183,14 +183,17 @@ def main(argv: list[str]) -> int:
183183
)
184184
return 1
185185

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

0 commit comments

Comments
 (0)