export async function getHelmPath()

in src/helm-util.ts [71:102]


export async function getHelmPath() {
   let helmPath = ''
   const version = core.getInput('helm-version', {required: false})
   if (version) {
      if (!!version && version != LATEST) {
         helmPath = toolCache.find(helmToolName, version)
      }
      if (helmPath) {
         helmPath = path.join(helmPath, `helm${getExecutableExtension()}`)
      } else {
         helmPath = await installHelm(version)
      }
   } else {
      helmPath = await io.which(helmToolName, false)
      if (!helmPath) {
         const allVersions = toolCache.findAllVersions(helmToolName)
         helmPath =
            allVersions.length > 0
               ? toolCache.find(helmToolName, allVersions[0])
               : ''
         if (!helmPath) {
            throw new Error(
               'helm is not installed, either add setup-helm action or provide "helm-version" input to download helm'
            )
         }
         helmPath = path.join(helmPath, `helm${getExecutableExtension()}`)
      }
   }

   core.debug(util.format('Helm executable path %s', helmPath))
   return helmPath
}