1

I am on appleboy/ssh-action and I have a very simple step built on it

steps:
  - name: execute remote commands
    uses: appleboy/ssh-action@master
    with:
      host: ${{ secrets.HOST }}
      username: ${{ secrets.USERNAME }}
      key: ${{ secrets.KEY }}
      port: ${{ secrets.PORT }}
      script: |
        echo "Go to the project space"
        cd $HOME/actions_workspace/actions-sample
        echo "Pulling the repo from the remote server"
        git pull origin main
        echo "Building the new container"
        docker-compose build

It works fine, but this is the output:

======CMD======
echo "Go to the project space"
cd $HOME/actions_workspace/actions-sample
echo "Pulling the repo from the remote server"
git pull origin main
echo "Building the new container"
docker-compose build

======END======
out: Go to the project space
out: Pulling the repo from the remote server
err: From github.com:floatingpurr/my-test-repo
err:  * branch            main       -> FETCH_HEAD
err:    3961b2c..26e6abe  main       -> origin/main
out: Updating 3961b2c..26e6abe
out: Fast-forward
out:  README.md          |  2 +-
out:  docker-compose.yml | 12 ++++++------
out:  2 files changed, 7 insertions(+), 7 deletions(-)
out: Building the new container
err: my-test-actions uses an image, skipping
==============================================
✅ Successfully executed commands to all host.
==============================================

I'm just wondering the reason why I see err: prefixes in the action output and not just out: (as I would have expected) since everything went fine.

floatingpurr
  • 7,749
  • 9
  • 46
  • 106
  • 3
    I suspect that means that `git` is printing those messages to `stderr` rather than `stdout`. – Barmar Mar 15 '21 at 16:56
  • Oh, really? Looks like the same is for `docker-compose`... is it "normal"? – floatingpurr Mar 15 '21 at 16:59
  • 1
    See e.g. https://unix.stackexchange.com/questions/331611/do-progress-reports-logging-information-belong-on-stderr-or-stdout – riQQ Mar 15 '21 at 18:52

1 Answers1

1

As I mentioned here, any informative messages, not to be consumed by machines, is to be routed to stderr.
As illustrated here

Verbose status and progress reports, especially human readable ones, should probably always go to stderr.

If you really need to, you could redirect stderr to stdout, but that is not needed here.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250