Copy a file over SSH and execute a command afterwards.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Herman verschooten fdd297a281
Fix intermittent exit code 1 from composite action
Composite actions run shell steps with `set -e`, causing the script to
exit immediately when scp returns non-zero. The `if [ $? -eq 0 ]` guard
around the remote command was unreachable in that case.

Remove broken dead-code conditionals for SCP_ARGS/CMD_ARGS defaults
(input defaults already handle this) and the unreachable $? check.
2026-03-02 10:20:25 +01:00
.github/workflows Use composite and run commands 2023-09-15 11:18:08 +02:00
.gitignore Initial commit 2023-09-15 09:37:22 +02:00
action.yml Fix intermittent exit code 1 from composite action 2026-03-02 10:20:25 +01:00
LICENSE Initial commit 2023-09-15 09:37:22 +02:00
README.md Use composite and run commands 2023-09-15 11:18:08 +02:00

ssh-copy-command-action

Copy a file over SSH and execute a command afterwards.

  - name: Deploy
    uses: Hermanverschooten/ssh-copy-command-action@v1
    env:
      SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }}
      SOURCE: "./source.tar.gz"
      REMOTE_HOST: my_host.example.org
      REMOTE_USER: root
      TARGET: "/opt/dest"
      CMD: "./deploy"

This action uses scp to copy the file to the remote destination, then reuses that master control socket to run the given command over ssh.