From daf547555888d9e203a25697d6ad1b21f0f67c82 Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Sat, 18 May 2024 21:11:29 -0500 Subject: [PATCH] Check checks in merge script --- bin/ckan_merge_pr.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bin/ckan_merge_pr.py b/bin/ckan_merge_pr.py index f545e08c77..3a6824b3ca 100755 --- a/bin/ckan_merge_pr.py +++ b/bin/ckan_merge_pr.py @@ -153,6 +153,14 @@ def merge_into(self, repo: CkanRepo, self_review: bool) -> bool: if not branch: print(f'PR #{self.pull_request.number} commit {self.pull_request.head.sha} not found!') return False + pr_commits = self.pull_request.get_commits() + incomplete_checks = [run + for run in pr_commits[pr_commits.totalCount - 1].get_check_runs() + if run.status != 'completed' + or run.conclusion not in ('success', 'skipped')] + if incomplete_checks: + print('Incomplete checks:', ', '.join(ch.name for ch in incomplete_checks)) + return False # Valid; do it! # repo.index.merge_tree doesn't auto resolve conflicts repo.git.merge(branch, no_commit=True, no_ff=True)