diff --git a/action.yml b/action.yml index 60c36bc..deed5eb 100644 --- a/action.yml +++ b/action.yml @@ -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"