Skip to content

Commit 20d5c5b

Browse files
committed
feat: add configurable curl insecure flag to GitHub action
- Add input parameter `curl_insecure` to `action.yml` with a default value of false - Pass `curl_insecure` input to the action's environment in `action.yml` - Modify `entrypoint.sh` to conditionally add the `--insecure` option to curl if `INPUT_CURL_INSECURE` is true Signed-off-by: appleboy <[email protected]>
1 parent b27b9f8 commit 20d5c5b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ inputs:
7575
description: "When true, passes all GitHub Actions environment variables to the remote script."
7676
request_pty:
7777
description: "Request a pseudo-terminal from the server (required for interactive commands or sudo)."
78+
curl_insecure:
79+
description: "When true, uses the --insecure option with curl for insecure downloads."
80+
default: "false"
7881
capture_stdout:
7982
description: "When true, captures and returns standard output from the commands as action output."
8083
default: "false"
@@ -131,6 +134,7 @@ runs:
131134
INPUT_PROXY_CIPHER: ${{ inputs.proxy_cipher }}
132135
INPUT_SYNC: ${{ inputs.sync }}
133136
INPUT_CAPTURE_STDOUT: ${{ inputs.capture_stdout }}
137+
INPUT_CURL_INSECURE: ${{ inputs.curl_insecure }}
134138

135139
branding:
136140
icon: "terminal"

entrypoint.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ DOWNLOAD_URL_PREFIX="${DRONE_SSH_RELEASE_URL}/v${DRONE_SSH_VERSION}"
3636
CLIENT_BINARY="drone-ssh-${DRONE_SSH_VERSION}-${CLIENT_PLATFORM}-${CLIENT_ARCH}"
3737
TARGET="${GITHUB_ACTION_PATH}/${CLIENT_BINARY}"
3838
echo "Downloading ${CLIENT_BINARY} from ${DOWNLOAD_URL_PREFIX}"
39-
curl -fsSL --retry 5 --keepalive-time 2 "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o "${TARGET}"
39+
INSECURE_OPTION=""
40+
if [[ "${INPUT_CURL_INSECURE}" == 'true' ]]; then
41+
INSECURE_OPTION="--insecure"
42+
fi
43+
44+
curl -fsSL --retry 5 --keepalive-time 2 ${INSECURE_OPTION} "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o "${TARGET}"
4045
chmod +x "${TARGET}"
4146

4247
echo "======= CLI Version Information ======="

0 commit comments

Comments
 (0)