From 27b687e565b12513ca3c53f8de82c765439d4d70 Mon Sep 17 00:00:00 2001 From: GammaGames Date: Wed, 3 Apr 2024 10:02:10 -0600 Subject: [PATCH 01/17] rebase with upstream --- action.yml | 6 ++++++ entrypoint.sh | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 4a16472..26cdc45 100644 --- a/action.yml +++ b/action.yml @@ -73,6 +73,12 @@ inputs: request_pty: description: "Request a pseudo-terminal from the server." +outputs: + stdout: + description: 'Standard output of the executed commands.' + stderr: + description: 'Standard error of the executed commands.' + runs: using: "composite" steps: diff --git a/entrypoint.sh b/entrypoint.sh index f50d56e..6d7e1db 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -63,4 +63,12 @@ TARGET="${GITHUB_ACTION_PATH}/${CLIENT_BINARY}" echo "Will download ${CLIENT_BINARY} from ${DOWNLOAD_URL_PREFIX}" curl -fL --retry 3 --keepalive-time 2 "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o ${TARGET} chmod +x ${TARGET} -sh -c "${TARGET} $*" + +{ + sh -c "${TARGET} $*" +} 2> /tmp/errFile | tee /tmp/outFile + +stdout=$(cat /tmp/outFile) +stderr=$(cat /tmp/errFile) +echo "stdout=${stdout//$'\n'/\\n}" >> $GITHUB_OUTPUT +echo "stderr=${stderr//$'\n'/\\n}" >> $GITHUB_OUTPUT) From 396c696e031833b10e622afcf78ea81bcb27cf01 Mon Sep 17 00:00:00 2001 From: GammaGames Date: Wed, 3 Apr 2024 10:12:39 -0600 Subject: [PATCH 02/17] syntax fix --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 6d7e1db..71b3744 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -71,4 +71,4 @@ chmod +x ${TARGET} stdout=$(cat /tmp/outFile) stderr=$(cat /tmp/errFile) echo "stdout=${stdout//$'\n'/\\n}" >> $GITHUB_OUTPUT -echo "stderr=${stderr//$'\n'/\\n}" >> $GITHUB_OUTPUT) +echo "stderr=${stderr//$'\n'/\\n}" >> $GITHUB_OUTPUT From 4172428f490821c7e8e42fab851ab64a002eda90 Mon Sep 17 00:00:00 2001 From: GammaGames Date: Fri, 22 Nov 2024 16:56:52 -0700 Subject: [PATCH 03/17] make capturing optional --- action.yml | 6 ++++++ entrypoint.sh | 31 ++++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index ce55154..83deeed 100644 --- a/action.yml +++ b/action.yml @@ -77,6 +77,12 @@ inputs: description: "pass all environment variable to shell script." request_pty: description: "Request a pseudo-terminal from the server." + capture_stdout: + description: "Capture the stdout of the commands." + default: "false" + capture_stderr: + description: "Capture the stderr of the commands." + default: "false" outputs: stdout: diff --git a/entrypoint.sh b/entrypoint.sh index 482a0c9..d78e6aa 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -68,11 +68,28 @@ chmod +x ${TARGET} echo "======= CLI Version =======" sh -c "${TARGET} --version" # print version echo "===========================" -{ - sh -c "${TARGET} $*" # run the command -} 2> /tmp/errFile | tee /tmp/outFile +if [ ${{ inputs.capture_stdout }} == 'true' ] || [ "${{ inputs.capture_stderr }}" == 'true' ]; then + _stdout=/dev/stdout + _stderr=/dev/stderr + if [ "${{ inputs.capture_stdout }}" == 'true' ]; then + _stdout=/tmp/outFile + fi + if [ "${{ inputs.capture_stderr }}" == 'true' ]; then + _stderr=/tmp/errFile + fi + + { + sh -c "${TARGET} $*" # run the command + } 2> $_stderr | tee $_stdout -stdout=$(cat /tmp/outFile) -stderr=$(cat /tmp/errFile) -echo "stdout=${stdout//$'\n'/\\n}" >> $GITHUB_OUTPUT -echo "stderr=${stderr//$'\n'/\\n}" >> $GITHUB_OUTPUT + if [ "${{ inputs.capture_stdout }}" == 'true' ]; then + stdout=$(cat $_stdout) + echo "stdout=${stdout//$'\n'/\\n}" >> $GITHUB_OUTPUT + fi + if [ "${{ inputs.capture_stderr }}" == 'true' ]; then + stderr=$(cat $_stderr) + echo "stderr=${stderr//$'\n'/\\n}" >> $GITHUB_OUTPUT + fi +else + sh -c "${TARGET} $*" # run the command +fi From 765833ffce00afac0f2d125d9d25ce3b6353bc99 Mon Sep 17 00:00:00 2001 From: GammaGames Date: Mon, 25 Nov 2024 10:19:44 -0700 Subject: [PATCH 04/17] fix substitution? --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index d78e6aa..aa72e59 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -68,7 +68,7 @@ chmod +x ${TARGET} echo "======= CLI Version =======" sh -c "${TARGET} --version" # print version echo "===========================" -if [ ${{ inputs.capture_stdout }} == 'true' ] || [ "${{ inputs.capture_stderr }}" == 'true' ]; then +if [ "${{ inputs.capture_stdout }}" == 'true' ] || [ "${{ inputs.capture_stderr }}" == 'true' ]; then _stdout=/dev/stdout _stderr=/dev/stderr if [ "${{ inputs.capture_stdout }}" == 'true' ]; then From 1a1adf6ba5e155e6a70309d617fc0e676e60b97f Mon Sep 17 00:00:00 2001 From: GammaGames Date: Mon, 25 Nov 2024 10:29:44 -0700 Subject: [PATCH 05/17] use env --- action.yml | 2 ++ entrypoint.sh | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 83deeed..2811a42 100644 --- a/action.yml +++ b/action.yml @@ -136,6 +136,8 @@ runs: INPUT_PROXY_USE_INSECURE_CIPHER: ${{ inputs.proxy_use_insecure_cipher }} INPUT_PROXY_CIPHER: ${{ inputs.proxy_cipher }} INPUT_SYNC: ${{ inputs.sync }} + INPUT_CAPTURE_STDOUT: ${{ inputs.capture_stdout }} + INPUT_CAPTURE_STDERR: ${{ inputs.capture_stderr }} branding: icon: "terminal" diff --git a/entrypoint.sh b/entrypoint.sh index aa72e59..4545c53 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -68,13 +68,13 @@ chmod +x ${TARGET} echo "======= CLI Version =======" sh -c "${TARGET} --version" # print version echo "===========================" -if [ "${{ inputs.capture_stdout }}" == 'true' ] || [ "${{ inputs.capture_stderr }}" == 'true' ]; then +if [ "$INPUT_CAPTURE_STDOUT" == 'true' ] || [ "$INPUT_CAPTURE_STDERR" == 'true' ]; then _stdout=/dev/stdout _stderr=/dev/stderr - if [ "${{ inputs.capture_stdout }}" == 'true' ]; then + if [ "$INPUT_CAPTURE_STDOUT" == 'true' ]; then _stdout=/tmp/outFile fi - if [ "${{ inputs.capture_stderr }}" == 'true' ]; then + if [ "$INPUT_CAPTURE_STDERR" == 'true' ]; then _stderr=/tmp/errFile fi @@ -82,11 +82,11 @@ if [ "${{ inputs.capture_stdout }}" == 'true' ] || [ "${{ inputs.capture_stderr sh -c "${TARGET} $*" # run the command } 2> $_stderr | tee $_stdout - if [ "${{ inputs.capture_stdout }}" == 'true' ]; then + if [ "$INPUT_CAPTURE_STDOUT" == 'true' ]; then stdout=$(cat $_stdout) echo "stdout=${stdout//$'\n'/\\n}" >> $GITHUB_OUTPUT fi - if [ "${{ inputs.capture_stderr }}" == 'true' ]; then + if [ "$INPUT_CAPTURE_STDERR" == 'true' ]; then stderr=$(cat $_stderr) echo "stderr=${stderr//$'\n'/\\n}" >> $GITHUB_OUTPUT fi From 4819506395147258cd3fd214f7fa527fb7597863 Mon Sep 17 00:00:00 2001 From: GammaGames Date: Mon, 25 Nov 2024 10:34:29 -0700 Subject: [PATCH 06/17] attempt tests --- .github/workflows/stable.yml | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index 9209737..43f47b9 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -484,3 +484,65 @@ jobs: script: | whoami && echo 'hello world' && touch todo.txt sudo whoami + + testing-with-stdouterr: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: create new ssh server + run: | + docker run -d \ + --name=openssh-server \ + --hostname=openssh-server \ + -p 2222:2222 \ + -e SUDO_ACCESS=false \ + -e PASSWORD_ACCESS=true \ + -e USER_PASSWORD=password \ + -e USER_NAME=linuxserver.io \ + --restart unless-stopped \ + lscr.io/linuxserver/openssh-server:latest + docker exec openssh-server sh -c "hostname -i" > ip.txt + echo "REMOTE_HOST<> $GITHUB_ENV + cat ip.txt >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + echo "======= container ip address =========" + cat ip.txt + echo "======================================" + sleep 2 + + - name: ssh command with stdout + uses: appleboy/ssh-action@v1.2.0 + with: + host: ${{ env.REMOTE_HOST }} + username: linuxserver.io + password: password + port: 2222 + capture_stdout: 'true' + script: | + #!/usr/bin/env bash + set -e + whoami + + - name: check stdout + run: | + echo "stdout: ${{ steps.ssh-command-with-stdout.outputs.stdout }}" + + - name: ssh command with stderr + uses: appleboy/ssh-action@v1.2.0 + continue-on-error: true + with: + host: ${{ env.REMOTE_HOST }} + username: linuxserver.io + password: password + port: 2222 + capture_stderr: 'true' + script: | + #!/usr/bin/env bash + set -e + ls /root + + - name: check stderr + run: | + echo "stderr: ${{ steps.ssh-command-with-stderr.outputs.stderr }}" From bd67bfa8815808a496557497ed5cb12d09667a2f Mon Sep 17 00:00:00 2001 From: GammaGames Date: Mon, 25 Nov 2024 11:47:21 -0700 Subject: [PATCH 07/17] remove stderr, stdout works --- .github/workflows/main.yml | 45 ++++++++++++++++++++++++++ .github/workflows/stable.yml | 62 ------------------------------------ action.yml | 6 ---- entrypoint.sh | 23 +++++-------- testdata/test.sh | 1 + 5 files changed, 54 insertions(+), 83 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6c35463..0e0fa68 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -523,3 +523,48 @@ jobs: command_timeout: 30s script: | whoami + + testing-capturing-output: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: create new ssh server + run: | + docker run -d \ + --name=openssh-server \ + --hostname=openssh-server \ + -p 2222:2222 \ + -e SUDO_ACCESS=false \ + -e PASSWORD_ACCESS=true \ + -e USER_PASSWORD=password \ + -e USER_NAME=linuxserver.io \ + --restart unless-stopped \ + lscr.io/linuxserver/openssh-server:latest + docker exec openssh-server sh -c "hostname -i" > ip.txt + echo "REMOTE_HOST<> $GITHUB_ENV + cat ip.txt >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + echo "======= container ip address =========" + cat ip.txt + echo "======================================" + sleep 2 + + - id: stdout + name: ssh command with stdout + uses: ./ + with: + host: ${{ env.REMOTE_HOST }} + username: linuxserver.io + password: password + port: 2222 + capture_stdout: 'true' + script: | + #!/usr/bin/env bash + set -e + whoami + + - name: check stdout + run: | + echo "stdout: ${{ steps.stdout.outputs.stdout }}" diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index 43f47b9..9209737 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -484,65 +484,3 @@ jobs: script: | whoami && echo 'hello world' && touch todo.txt sudo whoami - - testing-with-stdouterr: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: create new ssh server - run: | - docker run -d \ - --name=openssh-server \ - --hostname=openssh-server \ - -p 2222:2222 \ - -e SUDO_ACCESS=false \ - -e PASSWORD_ACCESS=true \ - -e USER_PASSWORD=password \ - -e USER_NAME=linuxserver.io \ - --restart unless-stopped \ - lscr.io/linuxserver/openssh-server:latest - docker exec openssh-server sh -c "hostname -i" > ip.txt - echo "REMOTE_HOST<> $GITHUB_ENV - cat ip.txt >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - echo "======= container ip address =========" - cat ip.txt - echo "======================================" - sleep 2 - - - name: ssh command with stdout - uses: appleboy/ssh-action@v1.2.0 - with: - host: ${{ env.REMOTE_HOST }} - username: linuxserver.io - password: password - port: 2222 - capture_stdout: 'true' - script: | - #!/usr/bin/env bash - set -e - whoami - - - name: check stdout - run: | - echo "stdout: ${{ steps.ssh-command-with-stdout.outputs.stdout }}" - - - name: ssh command with stderr - uses: appleboy/ssh-action@v1.2.0 - continue-on-error: true - with: - host: ${{ env.REMOTE_HOST }} - username: linuxserver.io - password: password - port: 2222 - capture_stderr: 'true' - script: | - #!/usr/bin/env bash - set -e - ls /root - - - name: check stderr - run: | - echo "stderr: ${{ steps.ssh-command-with-stderr.outputs.stderr }}" diff --git a/action.yml b/action.yml index 2811a42..2f8594c 100644 --- a/action.yml +++ b/action.yml @@ -80,15 +80,10 @@ inputs: capture_stdout: description: "Capture the stdout of the commands." default: "false" - capture_stderr: - description: "Capture the stderr of the commands." - default: "false" outputs: stdout: description: 'Standard output of the executed commands.' - stderr: - description: 'Standard error of the executed commands.' runs: using: "composite" @@ -137,7 +132,6 @@ runs: INPUT_PROXY_CIPHER: ${{ inputs.proxy_cipher }} INPUT_SYNC: ${{ inputs.sync }} INPUT_CAPTURE_STDOUT: ${{ inputs.capture_stdout }} - INPUT_CAPTURE_STDERR: ${{ inputs.capture_stderr }} branding: icon: "terminal" diff --git a/entrypoint.sh b/entrypoint.sh index 4545c53..62c1d76 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -68,27 +68,20 @@ chmod +x ${TARGET} echo "======= CLI Version =======" sh -c "${TARGET} --version" # print version echo "===========================" -if [ "$INPUT_CAPTURE_STDOUT" == 'true' ] || [ "$INPUT_CAPTURE_STDERR" == 'true' ]; then +if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then _stdout=/dev/stdout - _stderr=/dev/stderr - if [ "$INPUT_CAPTURE_STDOUT" == 'true' ]; then - _stdout=/tmp/outFile - fi - if [ "$INPUT_CAPTURE_STDERR" == 'true' ]; then - _stderr=/tmp/errFile + if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then + _stdout=/tmp/_stdout fi { sh -c "${TARGET} $*" # run the command - } 2> $_stderr | tee $_stdout + } | tee $_stdout - if [ "$INPUT_CAPTURE_STDOUT" == 'true' ]; then - stdout=$(cat $_stdout) - echo "stdout=${stdout//$'\n'/\\n}" >> $GITHUB_OUTPUT - fi - if [ "$INPUT_CAPTURE_STDERR" == 'true' ]; then - stderr=$(cat $_stderr) - echo "stderr=${stderr//$'\n'/\\n}" >> $GITHUB_OUTPUT + if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then + echo 'stdout<> $GITHUB_OUTPUT + cat $_stdout >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT fi else sh -c "${TARGET} $*" # run the command diff --git a/testdata/test.sh b/testdata/test.sh index a229cae..def0e24 100644 --- a/testdata/test.sh +++ b/testdata/test.sh @@ -1,3 +1,4 @@ #!/usr/bin/env bash set -e +echo "Hello, World!" whoami From 5ec72068f5b07c9dfd2e3342b604b07db517be79 Mon Sep 17 00:00:00 2001 From: GammaGames Date: Mon, 25 Nov 2024 11:49:07 -0700 Subject: [PATCH 08/17] test variables --- entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 62c1d76..3d9c1d2 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -68,6 +68,7 @@ chmod +x ${TARGET} echo "======= CLI Version =======" sh -c "${TARGET} --version" # print version echo "===========================" +echo "STDOUT: $INPUT_CAPTURE_STDOUT" if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then _stdout=/dev/stdout if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then @@ -79,6 +80,7 @@ if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then } | tee $_stdout if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then + echo 'CAPTURING STDOUT' echo 'stdout<> $GITHUB_OUTPUT cat $_stdout >> $GITHUB_OUTPUT echo 'EOF' >> $GITHUB_OUTPUT From c14811a802058978f4c5b42a75516d463fe798d3 Mon Sep 17 00:00:00 2001 From: GammaGames Date: Mon, 25 Nov 2024 11:53:18 -0700 Subject: [PATCH 09/17] tesing --- entrypoint.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 3d9c1d2..96ec81e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -80,7 +80,8 @@ if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then } | tee $_stdout if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then - echo 'CAPTURING STDOUT' + echo "CAPTURING STDOUT $_stdout" + cat $_stdout echo 'stdout<> $GITHUB_OUTPUT cat $_stdout >> $GITHUB_OUTPUT echo 'EOF' >> $GITHUB_OUTPUT From 4188bdc3ce9e1aeffd222f17813a09fbfd34424e Mon Sep 17 00:00:00 2001 From: GammaGames Date: Mon, 25 Nov 2024 11:59:10 -0700 Subject: [PATCH 10/17] capturing stdout --- entrypoint.sh | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 96ec81e..fca589b 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -68,24 +68,10 @@ chmod +x ${TARGET} echo "======= CLI Version =======" sh -c "${TARGET} --version" # print version echo "===========================" -echo "STDOUT: $INPUT_CAPTURE_STDOUT" if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then - _stdout=/dev/stdout - if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then - _stdout=/tmp/_stdout - fi - - { - sh -c "${TARGET} $*" # run the command - } | tee $_stdout - - if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then - echo "CAPTURING STDOUT $_stdout" - cat $_stdout - echo 'stdout<> $GITHUB_OUTPUT - cat $_stdout >> $GITHUB_OUTPUT - echo 'EOF' >> $GITHUB_OUTPUT - fi + echo 'stdout<> $GITHUB_OUTPUT # use a heredoc for multiline output + sh -c "${TARGET} $*" >> $GITHUB_OUTPUT # run the command + echo 'EOF' >> $GITHUB_OUTPUT else sh -c "${TARGET} $*" # run the command fi From 058ddd1a69974c188e33f94f7d077d64e0533140 Mon Sep 17 00:00:00 2001 From: GammaGames Date: Mon, 25 Nov 2024 12:03:35 -0700 Subject: [PATCH 11/17] test --- entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index fca589b..113a459 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -72,6 +72,8 @@ if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then echo 'stdout<> $GITHUB_OUTPUT # use a heredoc for multiline output sh -c "${TARGET} $*" >> $GITHUB_OUTPUT # run the command echo 'EOF' >> $GITHUB_OUTPUT + + echo 'stdout=foobar' >> $GITHUB_OUTPUT else sh -c "${TARGET} $*" # run the command fi From 210ea25b055a34b9335a3c38534c08cb0b281721 Mon Sep 17 00:00:00 2001 From: GammaGames Date: Mon, 25 Nov 2024 12:16:14 -0700 Subject: [PATCH 12/17] cleanup --- entrypoint.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 113a459..b2a33d4 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -69,11 +69,9 @@ echo "======= CLI Version =======" sh -c "${TARGET} --version" # print version echo "===========================" if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then - echo 'stdout<> $GITHUB_OUTPUT # use a heredoc for multiline output + echo 'stdout<> $GITHUB_OUTPUT # use heredoc for multiline output sh -c "${TARGET} $*" >> $GITHUB_OUTPUT # run the command echo 'EOF' >> $GITHUB_OUTPUT - - echo 'stdout=foobar' >> $GITHUB_OUTPUT else sh -c "${TARGET} $*" # run the command fi From d855b8ad7c32a666d5635f17cc852dcf05f3bf04 Mon Sep 17 00:00:00 2001 From: GammaGames Date: Mon, 25 Nov 2024 12:18:08 -0700 Subject: [PATCH 13/17] cleanup --- testdata/test.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/testdata/test.sh b/testdata/test.sh index def0e24..a229cae 100644 --- a/testdata/test.sh +++ b/testdata/test.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash set -e -echo "Hello, World!" whoami From c1dc5db4d67becf8ab7d97ca2fa9271b5cf23e6c Mon Sep 17 00:00:00 2001 From: GammaGames Date: Mon, 25 Nov 2024 13:08:02 -0700 Subject: [PATCH 14/17] tee --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index b2a33d4..1c0edb8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -70,7 +70,7 @@ sh -c "${TARGET} --version" # print version echo "===========================" if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then echo 'stdout<> $GITHUB_OUTPUT # use heredoc for multiline output - sh -c "${TARGET} $*" >> $GITHUB_OUTPUT # run the command + sh -c "${TARGET} $*" | tee -a $GITHUB_OUTPUT # run the command echo 'EOF' >> $GITHUB_OUTPUT else sh -c "${TARGET} $*" # run the command From 40c4aada89d470fdae358a62cdff30d8b86e3195 Mon Sep 17 00:00:00 2001 From: GammaGames Date: Tue, 26 Nov 2024 14:46:49 -0700 Subject: [PATCH 15/17] map output value --- action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 2f8594c..8080f70 100644 --- a/action.yml +++ b/action.yml @@ -84,6 +84,7 @@ inputs: outputs: stdout: description: 'Standard output of the executed commands.' + value: ${{ steps.entrypoint.outputs.stdout }} runs: using: "composite" @@ -93,7 +94,8 @@ runs: shell: bash env: GITHUB_ACTION_PATH: ${{ github.action_path }} - - name: Run entrypoint.sh + - id: entrypoint + name: Run entrypoint.sh run: entrypoint.sh shell: bash env: From 6339d4b013c9cacf06601b9a69ca07a543aeebca Mon Sep 17 00:00:00 2001 From: GammaGames Date: Tue, 3 Dec 2024 08:41:12 -0700 Subject: [PATCH 16/17] fix upxstream conflicts --- .github/workflows/main.yml | 64 +++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e0fa68..c988842 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -123,22 +123,6 @@ jobs: port: 2222 script: whoami - - name: stop script if command error - uses: ./ - continue-on-error: true - with: - host: ${{ env.REMOTE_HOST }} - username: linuxserver.io - password: password - key: password - port: 2222 - script_stop: true - sync: true - debug: true - script: | - mkdir abc/def - ls -al - support-key-passphrase: runs-on: ubuntu-latest steps: @@ -215,7 +199,6 @@ jobs: key: ${{ env.PRIVATE_KEY }} port: 2222 passphrase: 1234 - script_stop: true script: | ls \ -lah @@ -292,7 +275,6 @@ jobs: username: linuxserver.io key: ${{ env.PRIVATE_KEY }} passphrase: 1234 - script_stop: true script: | whoami @@ -488,7 +470,6 @@ jobs: username: linuxserver.io key: ${{ env.PRIVATE_KEY }} port: 2222 - script_stop: true request_pty: true command_timeout: 30s script: | @@ -524,6 +505,51 @@ jobs: script: | whoami + testing07: + name: some special character + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: Set Environment Variables + run: | + PASS='3HUS$?8kLu)}' + printf "PASS=${PASS}" >> $GITHUB_ENV + + - name: create new ssh server + run: | + docker run -d \ + --name=openssh-server \ + --hostname=openssh-server \ + -p 2222:2222 \ + -e SUDO_ACCESS=false \ + -e PASSWORD_ACCESS=true \ + -e USER_PASSWORD='${{ env.PASS }}' \ + -e USER_NAME=linuxserver.io \ + --restart unless-stopped \ + lscr.io/linuxserver/openssh-server:latest + docker exec openssh-server sh -c "hostname -i" > ip.txt + echo "REMOTE_HOST<> $GITHUB_ENV + cat ip.txt >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + echo "======= container ip address =========" + cat ip.txt + echo "======================================" + sleep 2 + + - name: ssh by username and password + uses: ./ + with: + host: ${{ env.REMOTE_HOST }} + username: linuxserver.io + password: ${{ env.PASS }} + port: 2222 + script: | + #!/usr/bin/env bash + set -e + whoami + testing-capturing-output: runs-on: ubuntu-latest steps: From 05bfd68c72e4cb4f8b7d095eb120ccf453880a22 Mon Sep 17 00:00:00 2001 From: GammaGames Date: Tue, 3 Dec 2024 08:46:43 -0700 Subject: [PATCH 17/17] test bool --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c988842..4d8a6a4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -585,7 +585,7 @@ jobs: username: linuxserver.io password: password port: 2222 - capture_stdout: 'true' + capture_stdout: true script: | #!/usr/bin/env bash set -e