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 <me@jedevc.com>
  • Loading branch information
jedevc committed Oct 21, 2024
1 parent ea28f0a commit 4f2024d
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
@@ -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 | '.' |
12 changes: 10 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -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:
@@ -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

0 comments on commit 4f2024d

Please sign in to comment.