fix: update shell wrapper usage to include argument for remote execution
This commit is contained in:
parent
6f6f64807e
commit
5ca29a1899
3 changed files with 26 additions and 22 deletions
23
action.yml
23
action.yml
|
|
@ -183,16 +183,25 @@ runs:
|
|||
|
||||
cat << 'WRAPPER_EOF' > "$WRAPPER_PATH"
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Check if input file is provided
|
||||
if [ -z "$1" ]; then
|
||||
set -euo pipefail
|
||||
|
||||
# Runner normally passes a temp script path as the first argument.
|
||||
# If that isn't present, allow script to be piped to stdin.
|
||||
TMPDIR="${TMPDIR:-/tmp}"
|
||||
SCRIPT_FILE=""
|
||||
if [ -n "${1-}" ]; then
|
||||
SCRIPT_FILE="$1"
|
||||
elif ! [ -t 0 ]; then
|
||||
# Write stdin to a temp file
|
||||
TMP_SCRIPT=$(mktemp "$TMPDIR/ssh-remote-stdin-XXXXXX.sh" 2>/dev/null || mktemp -t ssh-remote-stdin-XXXXXX)
|
||||
cat - > "$TMP_SCRIPT"
|
||||
chmod +x "$TMP_SCRIPT"
|
||||
SCRIPT_FILE="$TMP_SCRIPT"
|
||||
else
|
||||
echo "Error: No script file provided" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCRIPT_FILE="$1"
|
||||
|
||||
# Check if script file exists
|
||||
if [ ! -f "$SCRIPT_FILE" ]; then
|
||||
echo "Error: Script file '$SCRIPT_FILE' not found" >&2
|
||||
|
|
@ -217,7 +226,7 @@ runs:
|
|||
if [ "${{ inputs.use-shell-wrapper }}" = "true" ]; then
|
||||
echo ""
|
||||
echo "To use the remote shell in subsequent steps, add:"
|
||||
echo " shell: ssh-remote"
|
||||
echo " shell: ssh-remote {0}"
|
||||
echo ""
|
||||
echo "The 'ssh-remote' shell is now available for use."
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue