Skip to content

Commit 017e57d

Browse files
committed
Add summary for executable verbs
Signed-off-by: Matias Pan <[email protected]>
1 parent 4f6f256 commit 017e57d

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,18 @@ jobs:
212212
target='${{ steps.test-call.outputs.output }}'
213213
if [[ "$target" == "hello, world!" ]]; then
214214
echo "matches"
215-
exit 0
216215
else
217216
echo "does not match"
218217
exit 1
219218
fi
220219
220+
if [[ -n "${GITHUB_STEP_SUMMARY}" ]]; then
221+
echo "job summary was written"
222+
else
223+
echo "job summary file missing"
224+
exit 1
225+
fi
226+
221227
shell:
222228
runs-on: "ubuntu-latest"
223229
steps:

action.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ runs:
115115
shell: bash
116116
env:
117117
INPUT_MODULE: ${{ inputs.module }}
118+
VERB: ${{ steps.assemble.outputs.verb }}
119+
CMD: ${{ inputs.args || inputs.call || steps.assemble.outputs.script }}
120+
SCRIPT: ${{ steps.assemble.outputs.script }}
118121
run: |
119122
tmpout=$(mktemp)
120123
tmperr=$(mktemp)
@@ -142,3 +145,37 @@ runs:
142145
if [[ -n "$trace_url" ]]; then
143146
echo "traceURL=$trace_url" >> "$GITHUB_OUTPUT"
144147
fi
148+
149+
# Write github job summary with executed command and trace url
150+
{
151+
echo -e "## Command\n"
152+
echo '```bash'
153+
cmd="dagger $VERB $CMD"
154+
if [[ -n "$INPUT_MODULE" ]]; then
155+
echo -e -E "DAGGER_MODULE=\"$INPUT_MODULE\" $cmd"
156+
else
157+
echo -e -E "$cmd"
158+
fi
159+
echo '```'
160+
if [[ -n "$SCRIPT" ]]; then
161+
echo -e "### Script\n"
162+
echo '```bash'
163+
cat "$SCRIPT"
164+
echo -e "\n"
165+
echo '```'
166+
fi
167+
168+
echo -e "## Dagger trace\n"
169+
if [[ -n "$trace_url" ]]; then
170+
echo "[$trace_url]($trace_url)"
171+
else
172+
echo "No trace available. To setup: [https://dagger.cloud/traces/setup](https://dagger.cloud/traces/setup)"
173+
fi
174+
175+
echo -e "## Dagger version\n"
176+
echo '```bash'
177+
dagger version || true
178+
echo '```'
179+
180+
echo -e "---\n"
181+
} >"${GITHUB_STEP_SUMMARY}"

0 commit comments

Comments
 (0)