Open
Description
Describe the bug
I want to get notifications with execution details (at least stdout, but having stderr would be nice as well) when script finishes, no matter what was the exit code.
Currently with capture_stdout: true
set, if one of the script lines returned non 0 exit code, action fails to grab stdout and store it in action output. Also tried to redirect stderr
to stdout
by adding 2>&1
to the end of the failing command, but that leads to the same errors in job log:
Run echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH
Run entrypoint.sh
Downloading drone-ssh-1.8.1-linux-amd64 from https://github.com/appleboy/drone-ssh/releases/download/v1.8.1
======= CLI Version Information =======
Drone SSH version 1.8.1
=======================================
2025/03/31 14:57:21 Process exited with status 1
Error: Process completed with exit code 1.
Error: Unable to process file command 'output' successfully.
Error: Invalid value. Matching delimiter not found 'EOF'
Yaml Config
name: Apply Changes
on:
push:
branches:
- main
jobs:
deploy:
name: Apply changes
runs-on: ubuntu-latest
steps:
- name: Init Tailscale
uses: tailscale/github-action@v3
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
- name: Apply compose files
id: apply_changes
uses: appleboy/ssh-action@master
with:
host: ${{ vars.DOCKER_HOST }}
username: github
key: ${{ secrets.DOCKER_SSH_PRIVATE_KEY }}
capture_stdout: true
script: |
#!/usr/bin/env bash
set -e
export CF_DNS_API_TOKEN=${{ secrets.CF_DNS_API_TOKEN }}
export CF_API_EMAIL=${{ vars.CF_API_EMAIL }}
cd /home/github/infra
docker compose up -d --force-recreate --remove-orphans // command that actually fails because of syntax error in compose file
- name: Notify Success
uses: rjstone/discord-webhook-notify@v1
if: success()
with:
severity: info
details: |
`${{ steps.apply_changes.outputs.stdout }}`
description: Changes applied successfully!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
- name: Notify Failure
uses: rjstone/discord-webhook-notify@v1
if: failure()
with:
severity: error
details: |
`${{ steps.apply_changes.outputs.stdout }}`
description: |
There were errors applying changes:
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}