appleboy / appleboy/ssh-action
When multiple hosts are used everything seems to execute on a single host instead of the intended host
- Dominant language
- Shell
- Stars
- 6.2k
- Forks
- 679
- Avg merge
- 35m
- Merged PRs (30d)
- 1
Description
## Describe the bug
If you have two jobs connecting to two different hosts, it issues all the commands against one of the hosts rather than the intended host.
If I do `SSH_HOST_1` and `SSH_HOST_2`, things seem to work just fine ... but if I do what's described below ... `SSH_HOST` and `JOBS_SSH_HOST` ... even though the logs show the right IP, everything just goes to `SSH_HOST`.
## Yaml Config
Please post your Yaml configuration file along with the output results.
```yaml
# This is a basic workflow that is manually triggered
name: Manual workflow
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
env:
SSH_HOST: '1.2.3.4'
JOBS_SSH_HOST: '5.6.7.8'
SSH_USER_1: user
SSH_USER_2: user
jobs:
job0:
runs-on: ubuntu-24.04
steps:
- name: Job0
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ env.SSH_HOST }}
username: ${{ env.SSH_USER_1 }}
key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
script: sleep 5 && touch ~/file0.txt
job1:
runs-on: ubuntu-24.04
needs:
- job0
steps:
- name: Job1
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ env.SSH_HOST }}
username: ${{ env.SSH_USER_1 }}
key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
script: sleep 5 && touch ~/file1.txt
- name: Job1b
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ env.SSH_HOST }}
username: ${{ env.SSH_USER_1 }}
key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
script: sleep 5 && touch ~/file1b.txt
job2:
runs-on: ubuntu-24.04
needs:
- job0
steps:
- name: Job2
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ env.JOBS_SSH_HOST }}
username: ${{ env.SSH_USER_2 }}
key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
script: sleep 5 && touch ~/file2.txt
- name: Job2b
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ env.JOBS_SSH_HOST }}
username: ${{ env.SSH_USER_2 }}
key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
script: sleep 5 && touch ~/file2b.txt
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.