fix: correct wrapper mktemp quote, create symlink to wrapper script, and register shell via

This commit is contained in:
Karolis2011 2025-11-20 00:07:43 +02:00
parent 763b8f8e8d
commit e20d2c2744

View file

@ -155,7 +155,7 @@ runs:
# the wrapper in the `GITHUB_WORKSPACE` to avoid polluting repo files.
# Prefer runner-specific temp folders (RUNNER_TEMP), then /tmp.
TEMP_DIR="${RUNNER_TEMP:-/tmp}"
WRAPPER_DIR=$(mktemp -d "$TEMP_DIR/setup-ssh-client-XXXXXX")"
WRAPPER_DIR=$(mktemp -d "$TEMP_DIR/setup-ssh-client-XXXXXX")
mkdir -p "$WRAPPER_DIR"
WRAPPER_PATH="$WRAPPER_DIR/ssh-remote-shell.sh"
@ -188,9 +188,10 @@ runs:
chmod +x "$WRAPPER_PATH"
echo "✅ SSH remote shell wrapper created at $WRAPPER_PATH"
# We also create symlink without the .sh extension for use in path
# We also create symlink without the .sh extension to provide a
# short executable name inside the wrapper dir (e.g. $WRAPPER_DIR/ssh-remote)
ln -s "$WRAPPER_PATH" "$WRAPPER_DIR/ssh-remote"
if [ "${{ inputs.use-shell-wrapper }}" = "true" ]; then
ln -s "$WRAPPER_DIR/ssh-remote" "$WRAPPER_PATH"
echo ""
echo "To use the remote shell in subsequent steps, add:"
echo " shell: ssh-remote"
@ -205,8 +206,9 @@ runs:
if: inputs.use-shell-wrapper == 'true'
shell: bash
run: |
SHELL_WRAPPER_DIR="${{ steps.setup-shell-wrapper.outputs.shell-wrapper-dir }}"
# Register custom shell for this job
echo "Adding custom shell 'ssh-remote' to PATH"
echo "$SHELL_WRAPPER_DIR" >> $GITHUB_PATH
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.
echo "ssh-remote=$SHELL_WRAPPER_PATH {0}" >> "$GITHUB_ENV"
echo "✅ Custom shell 'ssh-remote' registered for this job"