Skip to content

Commit 367e510

Browse files
committed
alias call to args and make it optional
Signed-off-by: kpenfound <kyle@dagger.io>
1 parent a320953 commit 367e510

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

.github/workflows/test.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,19 @@ jobs:
9393
echo "does not match"
9494
exit 1
9595
fi
96+
- name: "Test call"
97+
id: test-call
98+
uses: ./
99+
with:
100+
module: github.com/shykes/daggerverse/hello@v0.3.0
101+
call: hello
102+
- name: "Test call (check)"
103+
run: |
104+
target='${{ steps.test-call.outputs.output }}'
105+
if [[ "$target" == "hello, world!" ]]; then
106+
echo "matches"
107+
exit 0
108+
else
109+
echo "does not match"
110+
exit 1
111+
fi

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
- name: Hello
99
uses: dagger/dagger-for-github@v6
1010
with:
11-
verb: call
1211
module: github.com/shykes/daggerverse/hello
13-
args: hello --greeting Hola --name Jeremy
12+
call: hello --greeting Hola --name Jeremy
1413
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
1514
```
1615
@@ -43,4 +42,5 @@ By setting the version to `latest`, this action will install the latest version
4342
| `cloud-token` | Dagger Cloud Token | false | '' |
4443
| `module` | Dagger module to call. Local or Git | false | '' |
4544
| `args` | Arguments to pass to CLI | false | '' |
45+
| `call` | Arguments to pass to CLI (Alias for args) | false | '' |
4646
| `engine-stop` | Whether to stop the Dagger Engine after this run | false | 'true' |

action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ inputs:
3737
description: "Whether to stop the Dagger Engine after this run"
3838
required: false
3939
default: "true"
40+
call:
41+
description: "Function and arguments for dagger call"
42+
required: false
43+
default: ""
4044
outputs:
4145
output:
4246
description: "Job output"
@@ -70,22 +74,24 @@ runs:
7074
| BIN_DIR=${prefix_dir}/bin DAGGER_VERSION="$VERSION" DAGGER_COMMIT="$COMMIT" sh
7175
7276
- id: exec
77+
if: inputs.call != '' || inputs.args != ''
7378
shell: bash
7479
env:
7580
INPUT_MODULE: ${{ inputs.module }}
7681
run: |
7782
tmpout=$(mktemp)
83+
INPUT_ARGS="${ INPUT_ARGS:-INPUT_CALL }"
7884
cd ${{ inputs.workdir }} && { \
7985
DAGGER_CLOUD_TOKEN=${{ inputs.cloud-token }} \
8086
dagger \
8187
${{ inputs.dagger-flags }} \
8288
${{ inputs.verb }} \
8389
${INPUT_MODULE:+-m $INPUT_MODULE} \
84-
${{ inputs.args }}; } | tee "${tmpout}"
90+
$INPUT_ARGS; } | tee "${tmpout}"
8591
8692
(echo -n "stdout=" && cat "${tmpout}") >> "$GITHUB_OUTPUT"
8793
88-
- if: inputs.engine-stop == 'true'
94+
- if: (inputs.call != '' || inputs.args != '') && inputs.engine-stop == 'true'
8995
shell: bash
9096
run: |
9197
mapfile -t containers < <(docker ps --filter name="dagger-engine-*" -q)

0 commit comments

Comments
 (0)