Compare commits
	
		
			21 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					3c9bbdb0c9 | ||
| 
						 | 
					1c1ad10f6d | ||
| 
						 | 
					48531853a7 | ||
| 
						 | 
					b76e6173e8 | ||
| 
						 | 
					6137f733fb | ||
| 
						 | 
					43d4ebbb72 | ||
| 
						 | 
					a9e2fdf08d | ||
| 
						 | 
					cec69ef231 | ||
| 
						 | 
					a8952ebe2a | ||
| 
						 | 
					8fdfeb034e | ||
| 
						 | 
					7eaf76671a | ||
| 
						 | 
					176437b548 | ||
| 
						 | 
					25259c3d50 | ||
| 
						 | 
					bf84378588 | ||
| 
						 | 
					362a7f1677 | ||
| 
						 | 
					ab698e59d8 | ||
| 
						 | 
					703ffa3c1e | ||
| 
						 | 
					8b84eaec3a | ||
| 
						 | 
					2763143a97 | ||
| 
						 | 
					3f1416813d | ||
| 
						 | 
					bb32884d53 | 
							
								
								
									
										2
									
								
								.github/ISSUE_TEMPLATE/bug_report.md
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/ISSUE_TEMPLATE/bug_report.md
									
									
									
									
										vendored
									
									
								
							@@ -25,7 +25,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - name: executing remote ssh commands using password
 | 
			
		||||
      uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
      uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
      with:
 | 
			
		||||
        host: ${{ secrets.HOST }}
 | 
			
		||||
        username: ${{ secrets.USERNAME }}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										78
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										78
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							@@ -37,7 +37,19 @@ jobs:
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
          password: password
 | 
			
		||||
          port: 2222
 | 
			
		||||
          script: whoami
 | 
			
		||||
          script: |
 | 
			
		||||
            #!/usr/bin/env bash
 | 
			
		||||
            set -e
 | 
			
		||||
            whoami
 | 
			
		||||
 | 
			
		||||
      - name: ssh commands from a file
 | 
			
		||||
        uses: ./
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ env.REMOTE_HOST }}
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
          password: password
 | 
			
		||||
          port: 2222
 | 
			
		||||
          script_path: testdata/test.sh
 | 
			
		||||
 | 
			
		||||
  check-ssh-key:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
@@ -111,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:
 | 
			
		||||
@@ -203,7 +199,6 @@ jobs:
 | 
			
		||||
          key: ${{ env.PRIVATE_KEY }}
 | 
			
		||||
          port: 2222
 | 
			
		||||
          passphrase: 1234
 | 
			
		||||
          script_stop: true
 | 
			
		||||
          script: |
 | 
			
		||||
            ls \
 | 
			
		||||
              -lah
 | 
			
		||||
@@ -280,7 +275,6 @@ jobs:
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
          key: ${{ env.PRIVATE_KEY }}
 | 
			
		||||
          passphrase: 1234
 | 
			
		||||
          script_stop: true
 | 
			
		||||
          script: |
 | 
			
		||||
            whoami
 | 
			
		||||
 | 
			
		||||
@@ -476,7 +470,6 @@ jobs:
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
          key: ${{ env.PRIVATE_KEY }}
 | 
			
		||||
          port: 2222
 | 
			
		||||
          script_stop: true
 | 
			
		||||
          request_pty: true
 | 
			
		||||
          command_timeout: 30s
 | 
			
		||||
          script: |
 | 
			
		||||
@@ -511,3 +504,48 @@ jobs:
 | 
			
		||||
          command_timeout: 30s
 | 
			
		||||
          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<<EOF" >> $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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										63
									
								
								.github/workflows/stable.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										63
									
								
								.github/workflows/stable.yml
									
									
									
									
										vendored
									
									
								
							@@ -31,13 +31,25 @@ jobs:
 | 
			
		||||
          sleep 2
 | 
			
		||||
 | 
			
		||||
      - name: ssh by username and password
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ env.REMOTE_HOST }}
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
          password: password
 | 
			
		||||
          port: 2222
 | 
			
		||||
          script: whoami
 | 
			
		||||
          script: |
 | 
			
		||||
            #!/usr/bin/env bash
 | 
			
		||||
            set -e
 | 
			
		||||
            whoami
 | 
			
		||||
 | 
			
		||||
      - name: ssh commands from a file
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ env.REMOTE_HOST }}
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
          password: password
 | 
			
		||||
          port: 2222
 | 
			
		||||
          script_path: testdata/test.sh
 | 
			
		||||
 | 
			
		||||
  check-ssh-key:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
@@ -83,7 +95,7 @@ jobs:
 | 
			
		||||
          sleep 2
 | 
			
		||||
 | 
			
		||||
      - name: ssh by private key
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ env.REMOTE_HOST }}
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
@@ -92,7 +104,7 @@ jobs:
 | 
			
		||||
          script: whoami
 | 
			
		||||
 | 
			
		||||
      - name: wrong password but correct key
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ env.REMOTE_HOST }}
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
@@ -102,7 +114,7 @@ jobs:
 | 
			
		||||
          script: whoami
 | 
			
		||||
 | 
			
		||||
      - name: correct password but wrong key
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ env.REMOTE_HOST }}
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
@@ -111,22 +123,6 @@ jobs:
 | 
			
		||||
          port: 2222
 | 
			
		||||
          script: whoami
 | 
			
		||||
 | 
			
		||||
      - name: stop script if command error
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        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:
 | 
			
		||||
@@ -171,7 +167,7 @@ jobs:
 | 
			
		||||
          sleep 2
 | 
			
		||||
 | 
			
		||||
      - name: ssh key passphrase
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ env.REMOTE_HOST }}
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
@@ -183,7 +179,7 @@ jobs:
 | 
			
		||||
            ls -al
 | 
			
		||||
 | 
			
		||||
      - name: missing ssh key passphrase
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        continue-on-error: true
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ env.REMOTE_HOST }}
 | 
			
		||||
@@ -196,14 +192,13 @@ jobs:
 | 
			
		||||
 | 
			
		||||
      # https://github.com/appleboy/ssh-action/issues/75#issuecomment-668314271
 | 
			
		||||
      - name: Multiline SSH commands interpreted as single lines
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ env.REMOTE_HOST }}
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
          key: ${{ env.PRIVATE_KEY }}
 | 
			
		||||
          port: 2222
 | 
			
		||||
          passphrase: 1234
 | 
			
		||||
          script_stop: true
 | 
			
		||||
          script: |
 | 
			
		||||
            ls \
 | 
			
		||||
              -lah
 | 
			
		||||
@@ -274,13 +269,12 @@ jobs:
 | 
			
		||||
 | 
			
		||||
      # https://github.com/appleboy/ssh-action/issues/85
 | 
			
		||||
      - name: Deployment to multiple hosts with different ports
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        with:
 | 
			
		||||
          host: "${{ env.REMOTE_HOST_01 }}:2222,${{ env.REMOTE_HOST_02 }}:2222"
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
          key: ${{ env.PRIVATE_KEY }}
 | 
			
		||||
          passphrase: 1234
 | 
			
		||||
          script_stop: true
 | 
			
		||||
          script: |
 | 
			
		||||
            whoami
 | 
			
		||||
 | 
			
		||||
@@ -328,7 +322,7 @@ jobs:
 | 
			
		||||
          sleep 2
 | 
			
		||||
 | 
			
		||||
      - name: testing id_ed25519 key
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ env.REMOTE_HOST }}
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
@@ -381,7 +375,7 @@ jobs:
 | 
			
		||||
          sleep 2
 | 
			
		||||
 | 
			
		||||
      - name: testing id_ed25519 key
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ env.REMOTE_HOST }}
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
@@ -392,7 +386,7 @@ jobs:
 | 
			
		||||
            ls -al
 | 
			
		||||
 | 
			
		||||
      - name: pass environment
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        env:
 | 
			
		||||
          FOO: "BAR"
 | 
			
		||||
        with:
 | 
			
		||||
@@ -406,7 +400,7 @@ jobs:
 | 
			
		||||
            echo "I am $BAR, thanks"
 | 
			
		||||
 | 
			
		||||
      - name: pass multiple environment
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        env:
 | 
			
		||||
          FOO: "BAR"
 | 
			
		||||
          BAR: "FOO"
 | 
			
		||||
@@ -425,7 +419,7 @@ jobs:
 | 
			
		||||
            echo "port: $PORT"
 | 
			
		||||
 | 
			
		||||
      - name: custom envs format
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        env:
 | 
			
		||||
          FOO: "BAR"
 | 
			
		||||
          AAA: "BBB"
 | 
			
		||||
@@ -443,7 +437,7 @@ jobs:
 | 
			
		||||
            echo "I am $TEST_AAA, thanks"
 | 
			
		||||
 | 
			
		||||
      - name: pass all ENV variables to script
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        env:
 | 
			
		||||
          INPUT_FOO: "BAR"
 | 
			
		||||
          INPUT_AAA: "BBB"
 | 
			
		||||
@@ -460,13 +454,12 @@ jobs:
 | 
			
		||||
            echo "$GITHUB_REF"
 | 
			
		||||
 | 
			
		||||
      - name: switch to root user
 | 
			
		||||
        uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ env.REMOTE_HOST }}
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
          key: ${{ env.PRIVATE_KEY }}
 | 
			
		||||
          port: 2222
 | 
			
		||||
          script_stop: true
 | 
			
		||||
          request_pty: true
 | 
			
		||||
          command_timeout: 30s
 | 
			
		||||
          script: |
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										103
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										103
									
								
								README.md
									
									
									
									
									
								
							@@ -1,24 +1,21 @@
 | 
			
		||||
# 🚀 SSH for GitHub Actions
 | 
			
		||||
 | 
			
		||||
[繁體中文](./README.zh-tw.md)
 | 
			
		||||
[简体中文](./README.zh-cn.md)
 | 
			
		||||
[繁體中文](./README.zh-tw.md) | [简体中文](./README.zh-cn.md)
 | 
			
		||||
 | 
			
		||||
[GitHub Action](https://github.com/features/actions) for executing remote ssh commands.
 | 
			
		||||
[GitHub Action](https://github.com/features/actions) for executing remote SSH commands.
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
[](https://github.com/appleboy/ssh-action/actions)
 | 
			
		||||
[](https://github.com/appleboy/ssh-action/actions/workflows/main.yml)
 | 
			
		||||
 | 
			
		||||
**Important**: Only support **Linux** [docker](https://www.docker.com/) container.
 | 
			
		||||
 | 
			
		||||
This thing is built using [Golang](https://go.dev) and [drone-ssh](https://github.com/appleboy/drone-ssh). 🚀
 | 
			
		||||
This project is built using [Golang](https://go.dev) and [drone-ssh](https://github.com/appleboy/drone-ssh). 🚀
 | 
			
		||||
 | 
			
		||||
## Input variables
 | 
			
		||||
 | 
			
		||||
See [action.yml](./action.yml) for more detailed information.
 | 
			
		||||
 | 
			
		||||
| Input Parameter           | Description                                                                              | Default Value |
 | 
			
		||||
|---------------------------|------------------------------------------------------------------------------------------|---------------|
 | 
			
		||||
| ------------------------- | ---------------------------------------------------------------------------------------- | ------------- |
 | 
			
		||||
| host                      | SSH host address                                                                         |               |
 | 
			
		||||
| port                      | SSH port number                                                                          | 22            |
 | 
			
		||||
| passphrase                | SSH key passphrase                                                                       |               |
 | 
			
		||||
@@ -35,6 +32,7 @@ See [action.yml](./action.yml) for more detailed information.
 | 
			
		||||
| fingerprint               | SHA256 fingerprint of the host public key                                                |               |
 | 
			
		||||
| proxy_host                | SSH proxy host                                                                           |               |
 | 
			
		||||
| proxy_port                | SSH proxy port                                                                           | 22            |
 | 
			
		||||
| proxy_protocol            | SSH proxy protocol version (tcp, tcp4, tcp6)                                             | tcp           |
 | 
			
		||||
| proxy_username            | SSH proxy username                                                                       |               |
 | 
			
		||||
| proxy_password            | SSH proxy password                                                                       |               |
 | 
			
		||||
| proxy_passphrase          | SSH proxy key passphrase                                                                 |               |
 | 
			
		||||
@@ -45,31 +43,30 @@ See [action.yml](./action.yml) for more detailed information.
 | 
			
		||||
| proxy_cipher              | Allowed cipher algorithms for the proxy                                                  |               |
 | 
			
		||||
| proxy_use_insecure_cipher | Include more ciphers with use_insecure_cipher for the proxy                              | false         |
 | 
			
		||||
| script                    | Execute commands                                                                         |               |
 | 
			
		||||
| script_stop               | Stop script after first failure                                                          | false         |
 | 
			
		||||
| script_file               | Execute commands from a file                                                             |               |
 | 
			
		||||
| envs                      | Pass environment variables to shell script                                               |               |
 | 
			
		||||
| envs_format               | Flexible configuration of environment value transfer                                     |               |
 | 
			
		||||
| debug                     | Enable debug mode                                                                        | false         |
 | 
			
		||||
| allenvs                   | pass the environment variables with prefix value of `GITHUB_` and `INPUT_` to the script | false         |
 | 
			
		||||
| allenvs                   | Pass the environment variables with prefix value of `GITHUB_` and `INPUT_` to the script | false         |
 | 
			
		||||
| request_pty               | Request a pseudo-terminal from the server                                                | false         |
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
Executing remote ssh commands.
 | 
			
		||||
Executing remote SSH commands.
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
name: remote ssh command
 | 
			
		||||
on: [push]
 | 
			
		||||
jobs:
 | 
			
		||||
 | 
			
		||||
  build:
 | 
			
		||||
    name: Build
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: executing remote ssh commands using password
 | 
			
		||||
      uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ secrets.HOST }}
 | 
			
		||||
        username: ${{ secrets.USERNAME }}
 | 
			
		||||
          username: linuxserver.io
 | 
			
		||||
          password: ${{ secrets.PASSWORD }}
 | 
			
		||||
          port: ${{ secrets.PORT }}
 | 
			
		||||
          script: whoami
 | 
			
		||||
@@ -81,10 +78,10 @@ output:
 | 
			
		||||
======CMD======
 | 
			
		||||
whoami
 | 
			
		||||
======END======
 | 
			
		||||
out: ***
 | 
			
		||||
==============================================
 | 
			
		||||
✅ Successfully executed commands to all host.
 | 
			
		||||
==============================================
 | 
			
		||||
linuxserver.io
 | 
			
		||||
===============================================
 | 
			
		||||
✅ Successfully executed commands to all hosts.
 | 
			
		||||
===============================================
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Setting up a SSH Key
 | 
			
		||||
@@ -152,9 +149,9 @@ See the detail information about [SSH login without password](http://www.linuxpr
 | 
			
		||||
 | 
			
		||||
**A note** from one of our readers: Depending on your version of SSH you might also have to do the following changes:
 | 
			
		||||
 | 
			
		||||
* Put the public key in `.ssh/authorized_keys2`
 | 
			
		||||
* Change the permissions of `.ssh` to 700
 | 
			
		||||
* Change the permissions of `.ssh/authorized_keys2` to 640
 | 
			
		||||
- Put the public key in `.ssh/authorized_keys2`
 | 
			
		||||
- Change the permissions of `.ssh` to 700
 | 
			
		||||
- Change the permissions of `.ssh/authorized_keys2` to 640
 | 
			
		||||
 | 
			
		||||
### If you are using OpenSSH
 | 
			
		||||
 | 
			
		||||
@@ -182,7 +179,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: executing remote ssh commands using password
 | 
			
		||||
  uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
  uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
  with:
 | 
			
		||||
    host: ${{ secrets.HOST }}
 | 
			
		||||
    username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -195,7 +192,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: executing remote ssh commands using ssh key
 | 
			
		||||
  uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
  uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
  with:
 | 
			
		||||
    host: ${{ secrets.HOST }}
 | 
			
		||||
    username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -208,7 +205,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: multiple command
 | 
			
		||||
  uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
  uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
  with:
 | 
			
		||||
    host: ${{ secrets.HOST }}
 | 
			
		||||
    username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -221,11 +218,24 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
#### Commands from a file
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: file commands
 | 
			
		||||
  uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
  with:
 | 
			
		||||
    host: ${{ secrets.HOST }}
 | 
			
		||||
    username: ${{ secrets.USERNAME }}
 | 
			
		||||
    key: ${{ secrets.KEY }}
 | 
			
		||||
    port: ${{ secrets.PORT }}
 | 
			
		||||
    script_path: scripts/script.sh
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Multiple Hosts
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: multiple host
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
-     host: "foo.com"
 | 
			
		||||
+     host: "foo.com,bar.com"
 | 
			
		||||
@@ -243,7 +253,7 @@ The default value of `port` is `22`.
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: multiple host
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
-     host: "foo.com"
 | 
			
		||||
+     host: "foo.com:1234,bar.com:5678"
 | 
			
		||||
@@ -258,7 +268,7 @@ The default value of `port` is `22`.
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: multiple host
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
      host: "foo.com,bar.com"
 | 
			
		||||
+     sync: true
 | 
			
		||||
@@ -274,7 +284,7 @@ The default value of `port` is `22`.
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: pass environment
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
+   env:
 | 
			
		||||
+     FOO: "BAR"
 | 
			
		||||
+     BAR: "FOO"
 | 
			
		||||
@@ -293,37 +303,6 @@ The default value of `port` is `22`.
 | 
			
		||||
 | 
			
		||||
_Inside `env` object, you need to pass every environment variable as a string, passing `Integer` data type or any other may output unexpected results._
 | 
			
		||||
 | 
			
		||||
#### Stop script after first failure
 | 
			
		||||
 | 
			
		||||
> ex: missing `abc` folder
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: stop script if command error
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    with:
 | 
			
		||||
      host: ${{ secrets.HOST }}
 | 
			
		||||
      username: ${{ secrets.USERNAME }}
 | 
			
		||||
      key: ${{ secrets.KEY }}
 | 
			
		||||
      port: ${{ secrets.PORT }}
 | 
			
		||||
+     script_stop: true
 | 
			
		||||
      script: |
 | 
			
		||||
        mkdir abc/def
 | 
			
		||||
        ls -al
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
output:
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
======CMD======
 | 
			
		||||
mkdir abc/def
 | 
			
		||||
ls -al
 | 
			
		||||
 | 
			
		||||
======END======
 | 
			
		||||
2019/11/21 01:16:21 Process exited with status 1
 | 
			
		||||
err: mkdir: cannot create directory ‘abc/def’: No such file or directory
 | 
			
		||||
##[error]Docker run failed with exit code 1
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### How to connect remote server using `ProxyCommand`?
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
@@ -352,7 +331,7 @@ Host FooServer
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: ssh proxy command
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
      host: ${{ secrets.HOST }}
 | 
			
		||||
      username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -375,7 +354,7 @@ It is not uncommon for files to leak from backups or decommissioned hardware, an
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: ssh key passphrase
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
      host: ${{ secrets.HOST }}
 | 
			
		||||
      username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -401,7 +380,7 @@ Now you can adjust you config:
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: ssh key passphrase
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
      host: ${{ secrets.HOST }}
 | 
			
		||||
      username: ${{ secrets.USERNAME }}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										153
									
								
								README.zh-cn.md
									
									
									
									
									
								
							
							
						
						
									
										153
									
								
								README.zh-cn.md
									
									
									
									
									
								
							@@ -1,48 +1,54 @@
 | 
			
		||||
# 🚀 用于 GitHub Actions 的 SSH
 | 
			
		||||
 | 
			
		||||
[English](./README.md) | [繁體中文](./README.zh-tw.md)
 | 
			
		||||
 | 
			
		||||
[GitHub Action](https://github.com/features/actions) 用于执行远程 SSH 命令。
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
[](https://github.com/appleboy/ssh-action/actions)
 | 
			
		||||
[](https://github.com/appleboy/ssh-action/actions/workflows/main.yml)
 | 
			
		||||
 | 
			
		||||
**注意**: 只支持在 **Linux** [docker](https://www.docker.com/) 容器上执行。
 | 
			
		||||
该项目使用 [Golang](https://go.dev) 和 [drone-ssh](https://github.com/appleboy/drone-ssh) 构建。🚀
 | 
			
		||||
 | 
			
		||||
## 输入变量
 | 
			
		||||
 | 
			
		||||
更详细的信息,请参考 [action.yml](./action.yml)。
 | 
			
		||||
 | 
			
		||||
* `host` - SSH 主机
 | 
			
		||||
* `port` - SSH 连接端口,默认为 `22`
 | 
			
		||||
* `username` - SSH 用户名称
 | 
			
		||||
* `password` - SSH 密码
 | 
			
		||||
* `passphrase` - 通常用于加密私钥的 passphrase
 | 
			
		||||
* `sync` - 同步执行多个主机上的命令,默认为 false
 | 
			
		||||
* `timeout` - SSH 连接到远程主机的超时时间,默认为 `30s`
 | 
			
		||||
* `command_timeout` - SSH 命令超时时间,默认为 10m
 | 
			
		||||
* `key` - SSH 私钥的内容,例如 ~/.ssh/id_rsa 的原始内容,请记得包含 BEGIN 和 END 行
 | 
			
		||||
* `key_path` - SSH 私钥的路径
 | 
			
		||||
* `fingerprint` - 主机公钥的 SHA256 指纹,默认为跳过验证
 | 
			
		||||
* `script` - 执行命令
 | 
			
		||||
* `script_stop` - 当出现第一个错误时停止执行命令
 | 
			
		||||
* `envs` - 传递环境变量到 shell script
 | 
			
		||||
* `debug` - 启用调试模式
 | 
			
		||||
* `use_insecure_cipher` - 使用不安全的密码(ciphers)进行加密,详见 [#56](https://github.com/appleboy/ssh-action/issues/56)
 | 
			
		||||
* `cipher` - 允许使用的密码(ciphers)算法。如果未指定,则使用适当的算法
 | 
			
		||||
 | 
			
		||||
SSH 代理设置:
 | 
			
		||||
 | 
			
		||||
* `proxy_host` - 代理主机
 | 
			
		||||
* `proxy_port` - 代理端口,默认为 `22`
 | 
			
		||||
* `proxy_username` - 代理用户名
 | 
			
		||||
* `proxy_password` - 代理密码
 | 
			
		||||
* `proxy_passphrase` - 密码通常用于加密私有密钥
 | 
			
		||||
* `proxy_timeout` - SSH 连接至代理主机的超时时间,默认为 `30s`
 | 
			
		||||
* `proxy_key` - SSH 代理私有密钥内容
 | 
			
		||||
* `proxy_key_path` - SSH 代理私有密钥路径
 | 
			
		||||
* `proxy_fingerprint` - 代理主机公钥的 SHA256 指纹,默认为跳过验证
 | 
			
		||||
* `proxy_use_insecure_cipher` - 使用不安全的加密方式,详见 [#56](https://github.com/appleboy/ssh-action/issues/56)
 | 
			
		||||
* `proxy_cipher` - 允许的加密算法。如果未指定,则使用合理的算法
 | 
			
		||||
| 输入参数                  | 描述                                                  | 默认值 |
 | 
			
		||||
| ------------------------- | ----------------------------------------------------- | ------ |
 | 
			
		||||
| host                      | SSH 主机地址                                          |        |
 | 
			
		||||
| port                      | SSH 端口号                                            | 22     |
 | 
			
		||||
| passphrase                | SSH 密钥密码短语                                      |        |
 | 
			
		||||
| username                  | SSH 用户名                                            |        |
 | 
			
		||||
| password                  | SSH 密码                                              |        |
 | 
			
		||||
| protocol                  | SSH 协议版本(tcp, tcp4, tcp6)                       | tcp    |
 | 
			
		||||
| sync                      | 如果有多个主机,启用同步执行                          | false  |
 | 
			
		||||
| use_insecure_cipher       | 使用不安全的密码算法                                  | false  |
 | 
			
		||||
| cipher                    | 允许的密码算法。如果未指定,则使用适当的算法          |        |
 | 
			
		||||
| timeout                   | SSH 连接到主机的超时时间                              | 30s    |
 | 
			
		||||
| command_timeout           | SSH 命令的超时时间                                    | 10m    |
 | 
			
		||||
| key                       | SSH 私钥的内容,例如 ~/.ssh/id_rsa 的原始内容         |        |
 | 
			
		||||
| key_path                  | SSH 私钥的路径                                        |        |
 | 
			
		||||
| fingerprint               | 主机公钥的 SHA256 指纹                                |        |
 | 
			
		||||
| proxy_host                | SSH 代理主机                                          |        |
 | 
			
		||||
| proxy_port                | SSH 代理端口                                          | 22     |
 | 
			
		||||
| proxy_protocol            | SSH 代理协议版本(tcp, tcp4, tcp6)                   | tcp    |
 | 
			
		||||
| proxy_username            | SSH 代理用户名                                        |        |
 | 
			
		||||
| proxy_password            | SSH 代理密码                                          |        |
 | 
			
		||||
| proxy_passphrase          | SSH 代理密钥密码短语                                  |        |
 | 
			
		||||
| proxy_timeout             | SSH 连接到代理主机的超时时间                          | 30s    |
 | 
			
		||||
| proxy_key                 | SSH 代理私钥的内容                                    |        |
 | 
			
		||||
| proxy_key_path            | SSH 代理私钥的路径                                    |        |
 | 
			
		||||
| proxy_fingerprint         | 代理主机公钥的 SHA256 指纹                            |        |
 | 
			
		||||
| proxy_cipher              | 代理允许的密码算法                                    |        |
 | 
			
		||||
| proxy_use_insecure_cipher | 使用不安全的密码算法                                  | false  |
 | 
			
		||||
| script                    | 执行命令                                              |        |
 | 
			
		||||
| script_file               | 从文件执行命令                                        |        |
 | 
			
		||||
| envs                      | 传递环境变量到 shell 脚本                             |        |
 | 
			
		||||
| envs_format               | 环境变量传递的灵活配置                                |        |
 | 
			
		||||
| debug                     | 启用调试模式                                          | false  |
 | 
			
		||||
| allenvs                   | 将带有 `GITHUB_` 和 `INPUT_` 前缀的环境变量传递给脚本 | false  |
 | 
			
		||||
| request_pty               | 请求伪终端                                            | false  |
 | 
			
		||||
 | 
			
		||||
## 使用方法
 | 
			
		||||
 | 
			
		||||
@@ -52,13 +58,12 @@ SSH 代理设置:
 | 
			
		||||
name: remote ssh command
 | 
			
		||||
on: [push]
 | 
			
		||||
jobs:
 | 
			
		||||
 | 
			
		||||
  build:
 | 
			
		||||
    name: Build
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: executing remote ssh commands using password
 | 
			
		||||
      uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ secrets.HOST }}
 | 
			
		||||
          username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -74,9 +79,9 @@ jobs:
 | 
			
		||||
whoami
 | 
			
		||||
======END======
 | 
			
		||||
out: ***
 | 
			
		||||
==============================================
 | 
			
		||||
✅ Successfully executed commands to all host.
 | 
			
		||||
==============================================
 | 
			
		||||
===============================================
 | 
			
		||||
✅ Successfully executed commands to all hosts.
 | 
			
		||||
===============================================
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### 设置 SSH 密钥
 | 
			
		||||
@@ -127,9 +132,9 @@ clip < ~/.ssh/id_ed25519
 | 
			
		||||
 | 
			
		||||
**来自读者的注意事项**: 根据您的 SSH 版本,您可能还需要进行以下更改:
 | 
			
		||||
 | 
			
		||||
* 将公钥放在 `.ssh/authorized_keys2` 中
 | 
			
		||||
* 将 `.ssh` 的权限更改为700
 | 
			
		||||
* 将 `.ssh/authorized_keys2` 的权限更改为640
 | 
			
		||||
- 将公钥放在 `.ssh/authorized_keys2` 中
 | 
			
		||||
- 将 `.ssh` 的权限更改为 700
 | 
			
		||||
- 将 `.ssh/authorized_keys2` 的权限更改为 640
 | 
			
		||||
 | 
			
		||||
### 如果你使用的是 OpenSSH
 | 
			
		||||
 | 
			
		||||
@@ -157,7 +162,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: executing remote ssh commands using password
 | 
			
		||||
  uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
  uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
  with:
 | 
			
		||||
    host: ${{ secrets.HOST }}
 | 
			
		||||
    username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -170,7 +175,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: executing remote ssh commands using ssh key
 | 
			
		||||
  uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
  uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
  with:
 | 
			
		||||
    host: ${{ secrets.HOST }}
 | 
			
		||||
    username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -183,7 +188,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: multiple command
 | 
			
		||||
  uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
  uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
  with:
 | 
			
		||||
    host: ${{ secrets.HOST }}
 | 
			
		||||
    username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -200,7 +205,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: multiple host
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
-     host: ”foo.com“
 | 
			
		||||
+     host: ”foo.com,bar.com“
 | 
			
		||||
@@ -212,11 +217,24 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
 | 
			
		||||
        ls -al
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Commands from a file
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: file commands
 | 
			
		||||
  uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
  with:
 | 
			
		||||
    host: ${{ secrets.HOST }}
 | 
			
		||||
    username: ${{ secrets.USERNAME }}
 | 
			
		||||
    key: ${{ secrets.KEY }}
 | 
			
		||||
    port: ${{ secrets.PORT }}
 | 
			
		||||
    script_path: scripts/script.sh
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### 多个不同端口的主机
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: multiple host
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
-     host: ”foo.com“
 | 
			
		||||
+     host: ”foo.com:1234,bar.com:5678“
 | 
			
		||||
@@ -231,7 +249,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: multiple host
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
      host: ”foo.com,bar.com“
 | 
			
		||||
+     sync: true
 | 
			
		||||
@@ -247,7 +265,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: pass environment
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
+   env:
 | 
			
		||||
+     FOO: ”BAR“
 | 
			
		||||
+     BAR: ”FOO“
 | 
			
		||||
@@ -266,37 +284,6 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
 | 
			
		||||
 | 
			
		||||
_在 `env` 对象中,您需要将每个环境变量作为字符串传递,传递 `Integer` 数据类型或任何其他类型可能会产生意外结果。_
 | 
			
		||||
 | 
			
		||||
#### 在第一次失败后停止脚本
 | 
			
		||||
 | 
			
		||||
> ex: missing `abc` folder
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: stop script if command error
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    with:
 | 
			
		||||
      host: ${{ secrets.HOST }}
 | 
			
		||||
      username: ${{ secrets.USERNAME }}
 | 
			
		||||
      key: ${{ secrets.KEY }}
 | 
			
		||||
      port: ${{ secrets.PORT }}
 | 
			
		||||
+     script_stop: true
 | 
			
		||||
      script: |
 | 
			
		||||
        mkdir abc/def
 | 
			
		||||
        ls -al
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
画面输出:
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
======CMD======
 | 
			
		||||
mkdir abc/def
 | 
			
		||||
ls -al
 | 
			
		||||
 | 
			
		||||
======END======
 | 
			
		||||
2019/11/21 01:16:21 Process exited with status 1
 | 
			
		||||
err: mkdir: cannot create directory ‘abc/def’: No such file or directory
 | 
			
		||||
##[error]Docker run failed with exit code 1
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### 如何使用 `ProxyCommand` 连接远程服务器?
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
@@ -325,7 +312,7 @@ Host FooServer
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: ssh proxy command
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
      host: ${{ secrets.HOST }}
 | 
			
		||||
      username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -346,7 +333,7 @@ Host FooServer
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: ssh key passphrase
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
      host: ${{ secrets.HOST }}
 | 
			
		||||
      username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -362,7 +349,7 @@ Host FooServer
 | 
			
		||||
 | 
			
		||||
设置 SSH 主机指纹验证可以帮助防止中间人攻击。在设置之前,运行以下命令以获取 SSH 主机指纹。请记得将 `ed25519` 替换为您适当的密钥类型(`rsa`、 `dsa`等),而 `example.com` 则替换为您的主机。
 | 
			
		||||
 | 
			
		||||
现代 OpenSSH 版本中,需要提取的_默认密钥_类型是 `rsa`(从版本 5.1 开始)、`ecdsa`(从版本 6.0 开始)和 `ed25519`(从版本 6.7 开始)。
 | 
			
		||||
现代 OpenSSH 版本中,需要提取的**默认密钥**类型是 `rsa`(从版本 5.1 开始)、`ecdsa`(从版本 6.0 开始)和 `ed25519`(从版本 6.7 开始)。
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
ssh example.com ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub | cut -d ’ ‘ -f2
 | 
			
		||||
@@ -372,7 +359,7 @@ ssh example.com ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub | cut -d ’
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: ssh key passphrase
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
      host: ${{ secrets.HOST }}
 | 
			
		||||
      username: ${{ secrets.USERNAME }}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										161
									
								
								README.zh-tw.md
									
									
									
									
									
								
							
							
						
						
									
										161
									
								
								README.zh-tw.md
									
									
									
									
									
								
							@@ -1,50 +1,56 @@
 | 
			
		||||
# 🚀 用於 GitHub Actions 的 SSH
 | 
			
		||||
# 🚀 GitHub Actions 的 SSH
 | 
			
		||||
 | 
			
		||||
[GitHub Action](https://github.com/features/actions) for executing remote ssh commands.
 | 
			
		||||
[English](./README.md) | [简体中文](./README.zh-cn.md)
 | 
			
		||||
 | 
			
		||||
[GitHub Action](https://github.com/features/actions) 用於執行遠端 SSH 命令。
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
[](https://github.com/appleboy/ssh-action/actions)
 | 
			
		||||
[](https://github.com/appleboy/ssh-action/actions/workflows/main.yml)
 | 
			
		||||
 | 
			
		||||
**注意**: 只支援在 **Linux** [docker](https://www.docker.com/) 容器上執行。
 | 
			
		||||
此專案使用 [Golang](https://go.dev) 和 [drone-ssh](https://github.com/appleboy/drone-ssh) 建立。🚀
 | 
			
		||||
 | 
			
		||||
## 輸入變數
 | 
			
		||||
 | 
			
		||||
更詳細的資訊,請參閱 [action.yml](./action.yml)。
 | 
			
		||||
請參閱 [action.yml](./action.yml) 以獲取更詳細的信息。
 | 
			
		||||
 | 
			
		||||
* `host` - SSH 主機
 | 
			
		||||
* `port` - SSH 連接埠,預設為 `22`
 | 
			
		||||
* `username` - SSH 使用者名稱
 | 
			
		||||
* `password` - SSH 密碼
 | 
			
		||||
* `passphrase` - 通常用於加密私鑰的 passphrase
 | 
			
		||||
* `sync` - 同步執行多個主機上的命令,預設為 false
 | 
			
		||||
* `timeout` - SSH 連接到遠端主機的超時時間,預設為 `30s`
 | 
			
		||||
* `command_timeout` - SSH 命令超時時間,預設為 10m
 | 
			
		||||
* `key` - SSH 私鑰的內容,例如 ~/.ssh/id_rsa 的原始內容,請記得包含 BEGIN 和 END 行
 | 
			
		||||
* `key_path` - SSH 私鑰的路徑
 | 
			
		||||
* `fingerprint` - 主機公鑰的 SHA256 指紋,預設為略過驗證
 | 
			
		||||
* `script` - 執行命令
 | 
			
		||||
* `script_stop` - 當出現第一個錯誤時停止執行命令
 | 
			
		||||
* `envs` - 傳遞環境變數到 shell script
 | 
			
		||||
* `debug` - 啟用偵錯模式
 | 
			
		||||
* `use_insecure_cipher` - 使用不安全的密碼(ciphers)進行加密,參見 [#56](https://github.com/appleboy/ssh-action/issues/56)
 | 
			
		||||
* `cipher` - 允許使用的密碼(ciphers)演算法。如果未指定,則使用適當的演算法
 | 
			
		||||
| 輸入參數                  | 描述                                                  | 預設值 |
 | 
			
		||||
| ------------------------- | ----------------------------------------------------- | ------ |
 | 
			
		||||
| host                      | SSH 主機地址                                          |        |
 | 
			
		||||
| port                      | SSH 埠號                                              | 22     |
 | 
			
		||||
| passphrase                | SSH 金鑰密碼                                          |        |
 | 
			
		||||
| username                  | SSH 使用者名稱                                        |        |
 | 
			
		||||
| password                  | SSH 密碼                                              |        |
 | 
			
		||||
| protocol                  | SSH 協議版本 (tcp, tcp4, tcp6)                        | tcp    |
 | 
			
		||||
| sync                      | 如果有多個主機,啟用同步執行                          | false  |
 | 
			
		||||
| use_insecure_cipher       | 包含更多不安全的加密算法                              | false  |
 | 
			
		||||
| cipher                    | 允許的加密算法。如果未指定,則使用合理的預設值        |        |
 | 
			
		||||
| timeout                   | SSH 連接主機的超時時間                                | 30s    |
 | 
			
		||||
| command_timeout           | SSH 命令的超時時間                                    | 10m    |
 | 
			
		||||
| key                       | SSH 私鑰的內容。例如,~/.ssh/id_rsa 的原始內容        |        |
 | 
			
		||||
| key_path                  | SSH 私鑰的路徑                                        |        |
 | 
			
		||||
| fingerprint               | 主機公鑰的 SHA256 指紋                                |        |
 | 
			
		||||
| proxy_host                | SSH 代理主機                                          |        |
 | 
			
		||||
| proxy_port                | SSH 代理埠號                                          | 22     |
 | 
			
		||||
| proxy_protocol            | SSH 代理協議版本 (tcp, tcp4, tcp6)                    | tcp    |
 | 
			
		||||
| proxy_username            | SSH 代理使用者名稱                                    |        |
 | 
			
		||||
| proxy_password            | SSH 代理密碼                                          |        |
 | 
			
		||||
| proxy_passphrase          | SSH 代理金鑰密碼                                      |        |
 | 
			
		||||
| proxy_timeout             | SSH 連接代理主機的超時時間                            | 30s    |
 | 
			
		||||
| proxy_key                 | SSH 代理私鑰的內容                                    |        |
 | 
			
		||||
| proxy_key_path            | SSH 代理私鑰的路徑                                    |        |
 | 
			
		||||
| proxy_fingerprint         | 代理主機公鑰的 SHA256 指紋                            |        |
 | 
			
		||||
| proxy_cipher              | 代理允許的加密算法                                    |        |
 | 
			
		||||
| proxy_use_insecure_cipher | 包含更多不安全的加密算法                              | false  |
 | 
			
		||||
| script                    | 執行命令                                              |        |
 | 
			
		||||
| script_file               | 從文件中執行命令                                      |        |
 | 
			
		||||
| envs                      | 將環境變數傳遞給 shell 腳本                           |        |
 | 
			
		||||
| envs_format               | 環境值傳遞的靈活配置                                  |        |
 | 
			
		||||
| debug                     | 啟用調試模式                                          | false  |
 | 
			
		||||
| allenvs                   | 將帶有 `GITHUB_` 和 `INPUT_` 前綴的環境變數傳遞給腳本 | false  |
 | 
			
		||||
| request_pty               | 從伺服器請求偽終端                                    | false  |
 | 
			
		||||
 | 
			
		||||
SSH 代理設置:
 | 
			
		||||
 | 
			
		||||
* `proxy_host` - 代理主機
 | 
			
		||||
* `proxy_port` - 代理端口,預設為 `22`
 | 
			
		||||
* `proxy_username` - 代理使用者名稱
 | 
			
		||||
* `proxy_password` - 代理密碼
 | 
			
		||||
* `proxy_passphrase` - 密碼通常用於加密私有金鑰
 | 
			
		||||
* `proxy_timeout` - SSH 連線至代理主機的逾時時間,預設為 `30s`
 | 
			
		||||
* `proxy_key` - SSH 代理私有金鑰內容
 | 
			
		||||
* `proxy_key_path` - SSH 代理私有金鑰路徑
 | 
			
		||||
* `proxy_fingerprint` - 代理主機公鑰的 SHA256 指紋,預設為跳過驗證
 | 
			
		||||
* `proxy_use_insecure_cipher` - 使用不安全的加密方式,請參閱 [#56](https://github.com/appleboy/ssh-action/issues/56)
 | 
			
		||||
* `proxy_cipher` - 允許的加密算法。如果未指定,則使用合理的算法
 | 
			
		||||
 | 
			
		||||
## 使用方式
 | 
			
		||||
## 用法
 | 
			
		||||
 | 
			
		||||
執行遠端 SSH 命令
 | 
			
		||||
 | 
			
		||||
@@ -52,13 +58,12 @@ SSH 代理設置:
 | 
			
		||||
name: remote ssh command
 | 
			
		||||
on: [push]
 | 
			
		||||
jobs:
 | 
			
		||||
 | 
			
		||||
  build:
 | 
			
		||||
    name: Build
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: executing remote ssh commands using password
 | 
			
		||||
      uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
        uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
        with:
 | 
			
		||||
          host: ${{ secrets.HOST }}
 | 
			
		||||
          username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -74,9 +79,9 @@ jobs:
 | 
			
		||||
whoami
 | 
			
		||||
======END======
 | 
			
		||||
out: ***
 | 
			
		||||
==============================================
 | 
			
		||||
✅ Successfully executed commands to all host.
 | 
			
		||||
==============================================
 | 
			
		||||
===============================================
 | 
			
		||||
✅ Successfully executed commands to all hosts.
 | 
			
		||||
===============================================
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### 設置 SSH 金鑰
 | 
			
		||||
@@ -127,9 +132,9 @@ clip < ~/.ssh/id_ed25519
 | 
			
		||||
 | 
			
		||||
**來自讀者的注意事項**: 根據您的 SSH 版本,您可能還需要進行以下更改:
 | 
			
		||||
 | 
			
		||||
* 將公鑰放在 `.ssh/authorized_keys2` 中
 | 
			
		||||
* 將 `.ssh` 的權限更改為700
 | 
			
		||||
* 將 `.ssh/authorized_keys2` 的權限更改為640
 | 
			
		||||
- 將公鑰放在 `.ssh/authorized_keys2` 中
 | 
			
		||||
- 將 `.ssh` 的權限更改為 700
 | 
			
		||||
- 將 `.ssh/authorized_keys2` 的權限更改為 640
 | 
			
		||||
 | 
			
		||||
### 如果你使用的是 OpenSSH
 | 
			
		||||
 | 
			
		||||
@@ -157,7 +162,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: executing remote ssh commands using password
 | 
			
		||||
  uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
  uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
  with:
 | 
			
		||||
    host: ${{ secrets.HOST }}
 | 
			
		||||
    username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -170,7 +175,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: executing remote ssh commands using ssh key
 | 
			
		||||
  uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
  uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
  with:
 | 
			
		||||
    host: ${{ secrets.HOST }}
 | 
			
		||||
    username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -183,7 +188,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: multiple command
 | 
			
		||||
  uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
  uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
  with:
 | 
			
		||||
    host: ${{ secrets.HOST }}
 | 
			
		||||
    username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -196,11 +201,24 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
#### Commands from a file
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: file commands
 | 
			
		||||
  uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
  with:
 | 
			
		||||
    host: ${{ secrets.HOST }}
 | 
			
		||||
    username: ${{ secrets.USERNAME }}
 | 
			
		||||
    key: ${{ secrets.KEY }}
 | 
			
		||||
    port: ${{ secrets.PORT }}
 | 
			
		||||
    script_path: scripts/script.sh
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### 多台主機
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: multiple host
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
-     host: "foo.com"
 | 
			
		||||
+     host: "foo.com,bar.com"
 | 
			
		||||
@@ -216,7 +234,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: multiple host
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
-     host: "foo.com"
 | 
			
		||||
+     host: "foo.com:1234,bar.com:5678"
 | 
			
		||||
@@ -231,7 +249,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: multiple host
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
      host: "foo.com,bar.com"
 | 
			
		||||
+     sync: true
 | 
			
		||||
@@ -247,7 +265,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: pass environment
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
+   env:
 | 
			
		||||
+     FOO: "BAR"
 | 
			
		||||
+     BAR: "FOO"
 | 
			
		||||
@@ -266,37 +284,6 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
 | 
			
		||||
 | 
			
		||||
_在 `env` 對象中,您需要將每個環境變量作為字符串傳遞,傳遞 `Integer` 數據類型或任何其他類型可能會產生意外結果。_
 | 
			
		||||
 | 
			
		||||
#### 在第一次失敗後停止腳本
 | 
			
		||||
 | 
			
		||||
> ex: missing `abc` folder
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: stop script if command error
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    with:
 | 
			
		||||
      host: ${{ secrets.HOST }}
 | 
			
		||||
      username: ${{ secrets.USERNAME }}
 | 
			
		||||
      key: ${{ secrets.KEY }}
 | 
			
		||||
      port: ${{ secrets.PORT }}
 | 
			
		||||
+     script_stop: true
 | 
			
		||||
      script: |
 | 
			
		||||
        mkdir abc/def
 | 
			
		||||
        ls -al
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
畫面輸出:
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
======CMD======
 | 
			
		||||
mkdir abc/def
 | 
			
		||||
ls -al
 | 
			
		||||
 | 
			
		||||
======END======
 | 
			
		||||
2019/11/21 01:16:21 Process exited with status 1
 | 
			
		||||
err: mkdir: cannot create directory ‘abc/def’: No such file or directory
 | 
			
		||||
##[error]Docker run failed with exit code 1
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### 如何使用 `ProxyCommand` 連接遠程服務器?
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
@@ -325,7 +312,7 @@ Host FooServer
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: ssh proxy command
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
      host: ${{ secrets.HOST }}
 | 
			
		||||
      username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -346,7 +333,7 @@ Host FooServer
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: ssh key passphrase
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
      host: ${{ secrets.HOST }}
 | 
			
		||||
      username: ${{ secrets.USERNAME }}
 | 
			
		||||
@@ -362,7 +349,7 @@ Host FooServer
 | 
			
		||||
 | 
			
		||||
設置 SSH 主機指紋驗證可以幫助防止中間人攻擊。在設置之前,運行以下命令以獲取 SSH 主機指紋。請記得將 `ed25519` 替換為您的適當金鑰類型(`rsa`、 `dsa`等),而 `example.com` 則替換為您的主機。
 | 
			
		||||
 | 
			
		||||
現代 OpenSSH 版本中,需要提取的_默認金鑰_類型是 `rsa`(從版本 5.1 開始)、`ecdsa`(從版本 6.0 開始)和 `ed25519`(從版本 6.7 開始)。
 | 
			
		||||
現代 OpenSSH 版本中,需要提取的**默認金鑰**類型是 `rsa`(從版本 5.1 開始)、`ecdsa`(從版本 6.0 開始)和 `ed25519`(從版本 6.7 開始)。
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
ssh example.com ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub | cut -d ' ' -f2
 | 
			
		||||
@@ -372,7 +359,7 @@ ssh example.com ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub | cut -d ' '
 | 
			
		||||
 | 
			
		||||
```diff
 | 
			
		||||
  - name: ssh key passphrase
 | 
			
		||||
    uses: appleboy/ssh-action@v1.0.3
 | 
			
		||||
    uses: appleboy/ssh-action@v1.2.0
 | 
			
		||||
    with:
 | 
			
		||||
      host: ${{ secrets.HOST }}
 | 
			
		||||
      username: ${{ secrets.USERNAME }}
 | 
			
		||||
 
 | 
			
		||||
@@ -43,6 +43,9 @@ inputs:
 | 
			
		||||
    description: "SSH proxy username."
 | 
			
		||||
  proxy_password:
 | 
			
		||||
    description: "SSH proxy password."
 | 
			
		||||
  proxy_protocol:
 | 
			
		||||
    description: 'The IP protocol to use. Valid values are "tcp". "tcp4" or "tcp6". Default to tcp.'
 | 
			
		||||
    default: "tcp"
 | 
			
		||||
  proxy_passphrase:
 | 
			
		||||
    description: "SSH proxy key passphrase."
 | 
			
		||||
  proxy_timeout:
 | 
			
		||||
@@ -60,8 +63,8 @@ inputs:
 | 
			
		||||
    description: "Include more ciphers for the proxy by using insecure ciphers."
 | 
			
		||||
  script:
 | 
			
		||||
    description: "Commands to be executed."
 | 
			
		||||
  script_stop:
 | 
			
		||||
    description: "Stop the script after the first failure."
 | 
			
		||||
  script_path:
 | 
			
		||||
    description: "Path to the file containing commands to be executed."
 | 
			
		||||
  envs:
 | 
			
		||||
    description: "Environment variables to be passed to the shell script."
 | 
			
		||||
  envs_format:
 | 
			
		||||
@@ -107,7 +110,7 @@ runs:
 | 
			
		||||
        INPUT_PROXY_TIMEOUT: ${{ inputs.proxy_timeout }}
 | 
			
		||||
        INPUT_COMMAND_TIMEOUT: ${{ inputs.command_timeout }}
 | 
			
		||||
        INPUT_SCRIPT: ${{ inputs.script }}
 | 
			
		||||
        INPUT_SCRIPT_STOP: ${{ inputs.script_stop }}
 | 
			
		||||
        INPUT_SCRIPT_FILE: ${{ inputs.script_path }}
 | 
			
		||||
        INPUT_ENVS: ${{ inputs.envs }}
 | 
			
		||||
        INPUT_ENVS_FORMAT: ${{ inputs.envs_format }}
 | 
			
		||||
        INPUT_DEBUG: ${{ inputs.debug }}
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ export GITHUB="true"
 | 
			
		||||
 | 
			
		||||
GITHUB_ACTION_PATH="${GITHUB_ACTION_PATH%/}"
 | 
			
		||||
DRONE_SSH_RELEASE_URL="${DRONE_SSH_RELEASE_URL:-https://github.com/appleboy/drone-ssh/releases/download}"
 | 
			
		||||
DRONE_SSH_VERSION="${DRONE_SSH_VERSION:-1.7.7}"
 | 
			
		||||
DRONE_SSH_VERSION="${DRONE_SSH_VERSION:-1.8.0}"
 | 
			
		||||
 | 
			
		||||
function detect_client_info() {
 | 
			
		||||
  if [ -n "${SSH_CLIENT_OS-}" ]; then
 | 
			
		||||
@@ -31,6 +31,7 @@ function detect_client_info() {
 | 
			
		||||
      echo "Supported platforms: Linux, Darwin and Windows." >&2
 | 
			
		||||
      echo "Bailing out." >&2
 | 
			
		||||
      exit 2
 | 
			
		||||
      ;;
 | 
			
		||||
    esac
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
@@ -40,10 +41,10 @@ function detect_client_info() {
 | 
			
		||||
    local machine
 | 
			
		||||
    machine="$(uname -m)"
 | 
			
		||||
    case "${machine}" in
 | 
			
		||||
      x86_64*|i?86_64*|amd64*)
 | 
			
		||||
    x86_64* | i?86_64* | amd64*)
 | 
			
		||||
      CLIENT_ARCH="amd64"
 | 
			
		||||
      ;;
 | 
			
		||||
      aarch64*|arm64*)
 | 
			
		||||
    aarch64* | arm64*)
 | 
			
		||||
      CLIENT_ARCH="arm64"
 | 
			
		||||
      ;;
 | 
			
		||||
    *)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								testdata/test.sh
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								testdata/test.sh
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
whoami
 | 
			
		||||
		Reference in New Issue
	
	Block a user