Skip to content

Commit b019b11

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

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-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: 36 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,36 @@ 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 '```'
165+
fi
166+
167+
echo -e "## Dagger trace\n"
168+
if [[ -n "$trace_url" ]]; then
169+
echo "[$trace_url]($trace_url)"
170+
else
171+
echo "No trace available. To setup: [https://dagger.cloud/traces/setup](https://dagger.cloud/traces/setup)"
172+
fi
173+
174+
echo -e "## Dagger version\n"
175+
echo '```bash'
176+
dagger version || true
177+
echo '```'
178+
179+
echo -e "---\n"
180+
} >"${GITHUB_STEP_SUMMARY}"

0 commit comments

Comments
 (0)