fix: mktemp wrapper creation and register custom shell via mapping
This commit is contained in:
parent
e20d2c2744
commit
8b0eaf3b2a
1 changed files with 6 additions and 4 deletions
10
action.yml
10
action.yml
|
|
@ -157,7 +157,7 @@ runs:
|
|||
TEMP_DIR="${RUNNER_TEMP:-/tmp}"
|
||||
WRAPPER_DIR=$(mktemp -d "$TEMP_DIR/setup-ssh-client-XXXXXX")
|
||||
mkdir -p "$WRAPPER_DIR"
|
||||
WRAPPER_PATH="$WRAPPER_DIR/ssh-remote-shell.sh"
|
||||
WRAPPER_PATH="$(mktemp "$WRAPPER_DIR/ssh-remote-shell-XXXXXX.sh")"
|
||||
|
||||
cat << 'WRAPPER_EOF' > "$WRAPPER_PATH"
|
||||
#!/bin/bash
|
||||
|
|
@ -180,6 +180,7 @@ runs:
|
|||
# Execute script on remote server
|
||||
# Use BatchMode to prevent interactive prompts
|
||||
# ConnectTimeout to fail fast if connection issues
|
||||
echo "Executing script on remote server '${{ inputs.ssh-host }}' via SSH..."
|
||||
ssh -o BatchMode=yes \
|
||||
-o ConnectTimeout=10 \
|
||||
github-action-host \
|
||||
|
|
@ -207,8 +208,9 @@ runs:
|
|||
shell: bash
|
||||
run: |
|
||||
SHELL_WRAPPER_PATH="${{ steps.setup-shell-wrapper.outputs.shell-wrapper-path }}"
|
||||
# Register custom shell for this job by setting a custom shell mapping
|
||||
# in $GITHUB_ENV. This maps the shell name to the path. The runner will
|
||||
# use the provided script path when 'shell: ssh-remote' is used in steps.
|
||||
# Register custom shell for this job by mapping the shell name to the
|
||||
# wrapper path. This is the recommended way to expose a custom shell
|
||||
# for `shell: ssh-remote` in subsequent steps. We do this conditionally
|
||||
# so `use-shell-wrapper` can be used to opt out.
|
||||
echo "ssh-remote=$SHELL_WRAPPER_PATH {0}" >> "$GITHUB_ENV"
|
||||
echo "✅ Custom shell 'ssh-remote' registered for this job"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue