From f39160d821c97776bb793d249a7d4b51a0d9a315 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Tue, 22 Jul 2025 00:46:11 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=85=F0=9F=A4=96=20Auto-format=20entire?= =?UTF-8?q?=20repository=20with=20Ruff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/normalize_needed_jobs_status.py | 50 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/src/normalize_needed_jobs_status.py b/src/normalize_needed_jobs_status.py index e09c316..f6525fe 100755 --- a/src/normalize_needed_jobs_status.py +++ b/src/normalize_needed_jobs_status.py @@ -68,21 +68,21 @@ def parse_inputs(raw_allowed_failures, raw_allowed_skips, raw_jobs): def log_decision_details( - job_matrix_succeeded, - jobs_allowed_to_fail, - jobs_allowed_to_be_skipped, - allowed_to_fail_jobs_succeeded, - allowed_to_be_skipped_jobs_succeeded, - jobs, - summary_file_streams, + job_matrix_succeeded, + jobs_allowed_to_fail, + jobs_allowed_to_be_skipped, + allowed_to_fail_jobs_succeeded, + allowed_to_be_skipped_jobs_succeeded, + jobs, + summary_file_streams, ): """Record the decisions made into console output.""" markdown_summary_lines = [] markdown_summary_lines += { '# ✓ All of the required dependency jobs succeeded 🎉🎉🎉' - if job_matrix_succeeded else - '# ❌ Some of the required to succeed jobs failed 😢😢😢' + if job_matrix_succeeded + else '# ❌ Some of the required to succeed jobs failed 😢😢😢', } markdown_summary_lines += {''} @@ -95,7 +95,6 @@ def log_decision_details( '🛈 Some of the allowed to fail jobs did not succeed.', } - if jobs_allowed_to_be_skipped and allowed_to_be_skipped_jobs_succeeded: markdown_summary_lines += { '🛈 All of the allowed to be skipped dependency jobs succeeded.', @@ -105,20 +104,21 @@ def log_decision_details( '🛈 Some of the allowed to be skipped jobs did not succeed.', } - markdown_summary_lines += { '📝 Job statuses:', } for name, job in jobs.items(): markdown_summary_lines += { - '📝 {name} → {emoji} {result} [{status}]'. - format( - emoji='✓' if job['result'] == 'success' - else '❌' if job['result'] == 'failure' + '📝 {name} → {emoji} {result} [{status}]'.format( + emoji='✓' + if job['result'] == 'success' + else '❌' + if job['result'] == 'failure' else '⬜', name=name, result=job['result'], - status='allowed to fail' if name in jobs_allowed_to_fail + status='allowed to fail' + if name in jobs_allowed_to_fail else 'required to succeed' if name not in jobs_allowed_to_be_skipped else 'required to succeed or be skipped', @@ -137,7 +137,6 @@ def main(argv): ) summary_file_path = pathlib.Path(os.environ['GITHUB_STEP_SUMMARY']) - jobs = inputs['jobs'] or {} jobs_allowed_to_fail = set(inputs['allowed_failures'] or []) jobs_allowed_to_be_skipped = set(inputs['allowed_skips'] or []) @@ -153,29 +152,29 @@ def main(argv): ) return 1 - job_matrix_succeeded = all( - job['result'] == 'success' for name, job in jobs.items() + job['result'] == 'success' + for name, job in jobs.items() if name not in (jobs_allowed_to_fail | jobs_allowed_to_be_skipped) ) and all( - job['result'] in {'skipped', 'success'} for name, job in jobs.items() + job['result'] in {'skipped', 'success'} + for name, job in jobs.items() if name in jobs_allowed_to_be_skipped ) set_final_result_outputs(job_matrix_succeeded) - allowed_to_fail_jobs_succeeded = all( - job['result'] == 'success' for name, job in jobs.items() + job['result'] == 'success' + for name, job in jobs.items() if name in jobs_allowed_to_fail ) - allowed_to_be_skipped_jobs_succeeded = all( - job['result'] == 'success' for name, job in jobs.items() + job['result'] == 'success' + for name, job in jobs.items() if name in jobs_allowed_to_be_skipped ) - with summary_file_path.open(mode=FILE_APPEND_MODE) as summary_file: log_decision_details( job_matrix_succeeded, @@ -187,7 +186,6 @@ def main(argv): summary_file_streams=(sys.stderr, summary_file), ) - return int(not job_matrix_succeeded)