mirror of
https://github.com/dagger/dagger-for-github.git
synced 2025-12-31 20:59:43 +11:00
Add summary for executable verbs (#192)
This commit is contained in:
parent
4f6f256cec
commit
27bae3a184
3 changed files with 112 additions and 12 deletions
55
action.yml
55
action.yml
|
|
@ -45,6 +45,14 @@ inputs:
|
|||
description: "Function and arguments for dagger shell"
|
||||
required: false
|
||||
default: ""
|
||||
summary-path:
|
||||
description: "File path to write the job summary"
|
||||
required: false
|
||||
default: ""
|
||||
enable-github-summary:
|
||||
description: "Whether to write summary to GITHUB_STEP_SUMMARY"
|
||||
required: false
|
||||
default: "false"
|
||||
outputs:
|
||||
output:
|
||||
description: "Job output"
|
||||
|
|
@ -115,6 +123,9 @@ runs:
|
|||
shell: bash
|
||||
env:
|
||||
INPUT_MODULE: ${{ inputs.module }}
|
||||
VERB: ${{ steps.assemble.outputs.verb }}
|
||||
CMD: ${{ inputs.args || inputs.call || steps.assemble.outputs.script }}
|
||||
SCRIPT: ${{ steps.assemble.outputs.script }}
|
||||
run: |
|
||||
tmpout=$(mktemp)
|
||||
tmperr=$(mktemp)
|
||||
|
|
@ -142,3 +153,47 @@ runs:
|
|||
if [[ -n "$trace_url" ]]; then
|
||||
echo "traceURL=$trace_url" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
# Generate job summary content
|
||||
summary_content(){
|
||||
echo -e "## Command\n"
|
||||
echo '```bash'
|
||||
cmd="dagger $VERB $CMD"
|
||||
if [[ -n "$INPUT_MODULE" ]]; then
|
||||
echo -e -E "DAGGER_MODULE=\"$INPUT_MODULE\" $cmd"
|
||||
else
|
||||
echo -e -E "$cmd"
|
||||
fi
|
||||
echo '```'
|
||||
if [[ -n "$SCRIPT" ]]; then
|
||||
echo -e "### Script\n"
|
||||
echo '```bash'
|
||||
cat "$SCRIPT"
|
||||
echo -e "\n"
|
||||
echo '```'
|
||||
fi
|
||||
|
||||
echo -e "## Dagger trace\n"
|
||||
if [[ -n "$trace_url" ]]; then
|
||||
echo "[$trace_url]($trace_url)"
|
||||
else
|
||||
echo "No trace available. To setup: [https://dagger.cloud/traces/setup](https://dagger.cloud/traces/setup)"
|
||||
fi
|
||||
|
||||
echo -e "## Dagger version\n"
|
||||
echo '```bash'
|
||||
dagger version || true
|
||||
echo '```'
|
||||
|
||||
echo -e "---\n"
|
||||
}
|
||||
|
||||
# Write to custom summary path if specified
|
||||
if [[ -n "${{ inputs.summary-path }}" ]]; then
|
||||
summary_content > "${{ inputs.summary-path }}"
|
||||
fi
|
||||
|
||||
# Write to GitHub step summary if enabled (default: true)
|
||||
if [[ "${{ inputs.enable-github-summary }}" == "true" ]]; then
|
||||
summary_content > "${GITHUB_STEP_SUMMARY}"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue