#!/usr/bin/env bash

set -euo pipefail

export GITHUB="true"

GITHUB_ACTION_PATH="${GITHUB_ACTION_PATH%/}"

# 直接将 TARGET 定义为我们自己放在仓库里的 drone-ssh 文件
TARGET="${GITHUB_ACTION_PATH}/drone-ssh"

echo "======= Using local CLI Version ======="
"${TARGET}" --version
echo "======================================="

# 【已移除】: 删除了所有 curl 下载相关的代码块

if [[ "${INPUT_CAPTURE_STDOUT}" == 'true' ]]; then
  {
    echo 'stdout<<EOF'
    "${TARGET}" "$@" | tee -a "${GITHUB_OUTPUT}"
    echo 'EOF'
  } >>"${GITHUB_OUTPUT}"
else
  "${TARGET}" "$@"
fi