dagger-for-github/README.md
Kyle Penfound 4e0ad19142
Proper support for shell input (#189)
* add options for shell

Signed-off-by: kpenfound <kyle@dagger.io>

assemble dagger command in new step with output

Signed-off-by: kpenfound <kyle@dagger.io>

fixing some inline bash

Signed-off-by: kpenfound <kyle@dagger.io>

wrap conditional inputs in quotes

Signed-off-by: kpenfound <kyle@dagger.io>

use cat for heredoc script file

Signed-off-by: kpenfound <kyle@dagger.io>

missing space in heredoc

Signed-off-by: kpenfound <kyle@dagger.io>

add tab ignore and dagger shebang

Signed-off-by: kpenfound <kyle@dagger.io>

use toJson and jq to safely write the shell input to a file

Signed-off-by: kpenfound <kyle@dagger.io>

put DAGGER_COMMAND in a variable

Signed-off-by: kpenfound <kyle@dagger.io>

missing semicolon for the dagger command

Signed-off-by: kpenfound <kyle@dagger.io>

safely evaluate if shell is set

Signed-off-by: kpenfound <kyle@dagger.io>

extra > in shell file write

Signed-off-by: kpenfound <kyle@dagger.io>

add some logging

Signed-off-by: kpenfound <kyle@dagger.io>

strip extra newline from jq when shell is not set

Signed-off-by: kpenfound <kyle@dagger.io>

debugging

Signed-off-by: kpenfound <kyle@dagger.io>

toJSON and jq will send null instead of empty string with no input

Signed-off-by: kpenfound <kyle@dagger.io>

safely handle all inputs

Signed-off-by: kpenfound <kyle@dagger.io>

did i fix the wrong thing?

Signed-off-by: kpenfound <kyle@dagger.io>

change up the approach a bit for an easier diff

Signed-off-by: kpenfound <kyle@dagger.io>

fix shell test

Signed-off-by: kpenfound <kyle@dagger.io>

single quotes around shell input

Signed-off-by: kpenfound <kyle@dagger.io>

try with piped input

Signed-off-by: kpenfound <kyle@dagger.io>

try single quotes again

Signed-off-by: kpenfound <kyle@dagger.io>

debug

Signed-off-by: kpenfound <kyle@dagger.io>

debug

Signed-off-by: kpenfound <kyle@dagger.io>

fix shell test

Signed-off-by: kpenfound <kyle@dagger.io>

does shell emit a newline?

Signed-off-by: kpenfound <kyle@dagger.io>

remove the trailing newline if its in stdout

Signed-off-by: kpenfound <kyle@dagger.io>

break the trailing output test

Signed-off-by: kpenfound <kyle@dagger.io>

fix shell test

Signed-off-by: kpenfound <kyle@dagger.io>

missed !

Signed-off-by: kpenfound <kyle@dagger.io>

add comment about weird test

Signed-off-by: kpenfound <kyle@dagger.io>

* use echo -n in shell test

Signed-off-by: kpenfound <kyle@dagger.io>

---------

Signed-off-by: kpenfound <kyle@dagger.io>
2025-09-16 13:19:53 -04:00

2.4 KiB

GitHub action to run Dagger

Usage Examples

dagger call

- name: Hello
  uses: dagger/dagger-for-github@8.0.0
  with:
    module: github.com/shykes/daggerverse/hello
    call: hello --greeting Hola --name Jeremy
    cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
    version: "latest"  # semver x.y.z

dagger shell

- name: Hello
  uses: dagger/dagger-for-github@8.0.0
  with:
    shell: container | from alpine | with-exec echo,"hello, world!" | stdout
    cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}

dagger run

- name: Integration Test
  uses: dagger/dagger-for-github@8.0.0
  with:
    workdir: db-service
    verb: run
    args: node build.js
    cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
    version: "latest"  # semver x.y.z

Staying in sync with the latest version

By setting the version to latest, this action will install the latest version of Dagger.

All with: input parameter options

Key Description Required Default
version Dagger Version true n/a use semver x.y.z or 'latest'
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 '.'
cloud-token Dagger Cloud Token false ''
module Dagger module to call. Local or Git false ''
args Arguments to pass to CLI false ''
call Arguments to pass to CLI (Alias for args with verb:call) false ''
shell Arguments to pass to CLI (Alias for args with verb:shell) false ''
engine-stop Whether to stop the Dagger Engine after this run false 'true'