code: def merge_if_passed_checks(self) -> Optional[Dict[str, Any]]:
      failed_ci_jobs = self.find_failed_ci_jobs()
      all_ci_passed = len(failed_ci_jobs) == 0
      has_one_approval = False
  
      if not all_ci_passed:
          failed_jobs_msg = "\n".join(
              [
                  f" * [{job['name']} (`{job['status']}`)]({job['url']})"
                  for job in failed_ci_jobs
              ]
          )
          self.comment(
              f"Cannot merge, these CI jobs are not successful on {self.head_oid()}:\n{failed_jobs_msg}"
          )
          return None
  
      missing_expected_jobs = self.find_missing_expected_jobs()
  
      if len(missing_expected_jobs) > 0:
          missing_jobs_msg = "\n".join(
              [f" * `{name}`" for name in missing_expected_jobs]
          )
          self.comment(
              f"Cannot merge, missing expected jobs:\n{missing_jobs_msg}"
          )
          return None
  
      head_commit_reviews = self.head_commit_reviews()
      for review in head_commit_reviews:
          if review["state"] == "CHANGES_REQUESTED":
              self.comment(
                  f"Cannot merge, found [this review]({review['url']}) on {self.head_oid()} with changes requested"
              )
              return None
  
          if review["state"] == "APPROVED":
              has_one_approval = True
              logging.info(
                  f"Found approving review: {to_json_str(review)}"
              )
  
      if has_one_approval and all_ci_passed:
          return self.merge()
      elif not has_one_approval:
          self.comment(
              f"Cannot merge, did not find any approving reviews from users with write access on {self.head_oid()}"
          )
          return None
      elif not all_ci_passed:
          self.comment(
              f"Cannot merge, CI did not pass on on {self.head_oid()}"
          )
          return None
  
imports: import os
  import json
  import argparse
  import sys
  import warnings
  import logging
  import traceback
  import re
  from typing import Dict, Any, List, Optional, Callable, Union
  from pathlib import Path
  from git_utils import git, GitHubRepo, parse_remote, post
  from cmd_utils import init_log
label_desc: Use image node_id 23 for calling the PR obj's underlying member method code with example usage: obj.merge_if_passed_checks() and returns: None, None, self, None, None, None