code: def get_latest_runner_build() -> Optional[str]:
      owner_repo = "dstackai/dstack"
      workflow_id = "build.yml"
      version_offset = 150
  
      repo = git.Repo(
          os.path.abspath(os.path.dirname(__file__)),
          search_parent_directories=True,
      )
      for remote in repo.remotes:
          if re.search(
              rf"[@/]github\.com[:/]{owner_repo}\.", remote.url
          ):
              break
      else:
          return None
  
      resp = requests.get(
          f"https://api.github.com/repos/{owner_repo}/actions/workflows/{workflow_id}/runs",
          headers={
              "Accept": "application/vnd.github+json",
              "X-GitHub-Api-Version": "2022-11-28",
          },
          params={
              "status": "success",
          },
      )
      resp.raise_for_status()
  
      head = repo.head.commit
      for run in resp.json()["workflow_runs"]:
          try:
              if repo.is_ancestor(run["head_sha"], head):
                  ver = str(run["run_number"] + version_offset)
                  logger.debug(
                      f"Found the latest runner build: %s", ver
                  )
                  return ver
          except git.GitCommandError as e:
              if "Not a valid commit name" not in e.stderr:
                  raise
      return None
  
imports: import os
  import re
  from abc import ABC, abstractmethod
  from typing import List, Optional
  import git
  import requests
  import yaml
  from dstack import version
  from dstack._internal import settings
  from dstack._internal.core.models.backends.base import BackendType
  from dstack._internal.core.models.instances import InstanceOfferWithAvailability, InstanceState, LaunchedGatewayInfo, LaunchedInstanceInfo
  from dstack._internal.core.models.runs import Job, Requirements, Run
  from dstack._internal.utils.logging import get_logger
label_desc: Use image node_id 10 for calling a global function with example usage: get_latest_runner_build() and returns: None, None, ver