Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add step summary in code block #156

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,42 @@ runs:
INPUT_MODULE: ${{ inputs.module }}
run: |
tmpout=$(mktemp)
cd ${{ inputs.workdir }} && { \
tmperr=$(mktemp)

cd ${{ inputs.workdir }} && {
DAGGER_CLOUD_TOKEN=${{ inputs.cloud-token }} \
dagger \
${{ inputs.dagger-flags }} \
${{ inputs.verb }} \
${INPUT_MODULE:+-m $INPUT_MODULE} \
${{ inputs.args }}; } | tee "${tmpout}"
${{ inputs.args }}
} > >(tee "${tmpout}") 2> >(tee "${tmperr}" >&2)

# Send stdout to GITHUB_OUTPUT
(echo -n "stdout=" && cat "${tmpout}") >> "$GITHUB_OUTPUT"

# Set up ANSI to HTML converter
sudo npm install -g ansi-to-html

# Append formatted stdout to GITHUB_STEP_SUMMARY
{
echo "### Dagger stdout"
echo ""
echo -n "<pre><code>"
cat "${tmpout}"
echo "</code></pre>"
echo ""
} >> $GITHUB_STEP_SUMMARY

# Append formatted stderr to GITHUB_STEP_SUMMARY
{
echo "### Dagger stderr"
echo ""
echo -n "<pre><code>"
ansi-to-html < "${tmperr}"
echo "</code></pre>"
echo ""
} >> $GITHUB_STEP_SUMMARY

- if: inputs.engine-stop == 'true'
shell: bash
Expand Down