Skip to content

Commit

Permalink
feat: add output for action
Browse files Browse the repository at this point in the history
To chain on from the github action, it's very useful to be able to get
the output from an action.

Signed-off-by: Justin Chadwell <[email protected]>
  • Loading branch information
jedevc committed Oct 21, 2024
1 parent ea28f0a commit 4f2024d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ By setting the version to `latest`, this action will install the latest version
| Key | Description | Required | Default |
| -------------- | ----------------------------------------------------------- | -------- | ------------------ |
| `version` | Dagger Version | false | '0.13.5' |
| `commit` | Dagger Dev Commit (overrides `version`) | false | '' |
| `commit` | Dagger Dev Commit (overrides `version`) | false | '' |
| `dagger-flags` | Dagger CLI Flags | false | '--progress plain' |
| `verb` | CLI verb (call, run, download, up, functions, shell, query) | false | 'call' |
| `workdir` | The working directory in which to run the Dagger CLI | false | '.' |
Expand Down
12 changes: 10 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ inputs:
description: "Whether to stop the Dagger Engine after this run"
required: false
default: "true"
outputs:
output:
description: "Job output"
value: ${{ steps.exec.outputs.stdout }}
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -69,17 +73,21 @@ runs:
curl -fsS https://dl.dagger.io/dagger/install.sh \
| BIN_DIR=${prefix_dir}/bin DAGGER_VERSION="$VERSION" DAGGER_COMMIT="$COMMIT" sh
- shell: bash
- id: exec
shell: bash
env:
INPUT_MODULE: ${{ inputs.module }}
run: |
tmpout=$(mktemp)
cd ${{ inputs.workdir }} && { \
DAGGER_CLOUD_TOKEN=${{ inputs.cloud-token }} \
dagger \
${{ inputs.dagger-flags }} \
${{ inputs.verb }} \
${INPUT_MODULE:+-m $INPUT_MODULE} \
${{ inputs.args }}; }
${{ inputs.args }}; } | tee "${tmpout}"
(echo -n "stdout=" && cat "${tmpout}") >> "$GITHUB_OUTPUT"
- if: inputs.engine-stop == 'true'
shell: bash
Expand Down

0 comments on commit 4f2024d

Please sign in to comment.