An alternate GitHub Action for running Dagger with better caching support.
This action is used in the memos-builds repository.
Important
This action is only for Linux runners.
- name: Run Dagger
uses: memospot/action-dagger@v1
with:
module: github.com/shykes/daggerverse/hello
call: hello --greeting Hola --name Jeremy- name: Run Dagger with specific version
uses: memospot/action-dagger@v1
with:
version: "0.19.11" # Pin to specific version
module: github.com/shykes/daggerverse/hello
call: hello- name: Run Dagger without caching
uses: memospot/action-dagger@v1
with:
cache-builds: false
module: github.com/shykes/daggerverse/hello
call: hello- name: Dagger Shell
uses: memospot/action-dagger@v1
with:
shell: container | from alpine | with-exec echo,"hello, world!" | stdout- name: Integration Test
uses: memospot/action-dagger@v1
with:
workdir: db-service
verb: run
args: node build.js| Key | Description | Required | Default |
|---|---|---|---|
version |
Dagger CLI version (semver or 'latest') | false | latest |
cache-builds |
Enable Dagger build cache persistence | false | true |
cache-binary |
Cache Dagger binary to avoid re-downloading | false | true |
cache-key |
Custom cache key (e.g. foo-${{ github.run_id }}) |
false | |
cache-mode |
Cache extraction mode (auto, direct, container) |
false | auto |
cache-timeout |
Timeout in minutes for cache save operations (0=disable) | false | "10" |
dagger-flags |
Dagger CLI Flags | false | --progress plain |
verb |
CLI verb (call, run, download, up, functions, shell, query) | false | call |
workdir |
Working directory for 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 |
Function and arguments for dagger call | false | |
shell |
Function and arguments for dagger shell | false | |
summary-path |
File path to write job summary | false | |
enable-github-summary |
Write summary to GITHUB_STEP_SUMMARY | false | false |
| Key | Description |
|---|---|
dagger-version |
The installed Dagger version |
cache-hit |
Whether binary was restored from cache |
binary-path |
Path to the installed Dagger binary |
output |
Standard output of Dagger command |
trace-url |
Dagger Cloud trace URL |
The Dagger binary is cached using GitHub Actions tool-cache by tool/version/arch lookup.
- Tool name:
dagger - Version: resolved Dagger version (including
latestresolution) - Arch: runner architecture (for example
amd64orarm64)
Dagger build cache persists the engine state volume to GitHub Actions Cache:
Default Behavior: "Rolling cache" strategy.
- Save Key:
dagger-<arch>-<run_id>(always unique, forcing a save) - Restore Key:
dagger-<arch>-(matches most recent previous run)
This ensures that every run saves its state on top of the previous one, maximizing cache freshness.
You can override the default key using cache-key. To maintain the recommended rolling cache behavior, ensure your key ends with a unique component like ${{ github.run_id }}.
- name: Run Dagger with custom key
uses: memospot/action-dagger@v1
with:
cache-key: "my-project-v2-${{ runner.os }}-${{ github.run_id }}"
module: github.com/shykes/daggerverse/hello
call: helloThe action will automatically derive the restore key by stripping the last hyphen-delimited segment (e.g., my-project-v2-${{ runner.os }}).
To invalidate the cache, simply change the prefix of your cache-key (e.g., from v1 to v2). If using defaults, the action handles versioning internally.
The cache-mode input controls how the Dagger engine state is cached:
auto(default): Automatically triesdirectmode first, then falls back tocontainerif it fails.direct: Uses direct volume mounting for faster cache operations. May encounter permission issues on some runners.container: Uses a busybox container to create/restore tarballs. Slower and with higher disk usage peak, but more reliable.
Cache failures in any mode are soft-failures - the action will emit a warning but continue execution.
- name: Run Dagger with explicit cache mode
uses: memospot/action-dagger@v1
with:
cache-mode: direct
module: github.com/shykes/daggerverse/hello
call: hello-
Update your workflow:
# Before uses: dagger/dagger-for-github@v7 # After uses: memospot/action-dagger@v1
-
New features available:
- Binary caching:
cache-binary: true - Build caching:
cache-builds: true - Version output:
${{ steps.dagger.outputs.dagger-version }}
- Binary caching:
-
Backward compatibility: Existing inputs continue to work
See CONTRIBUTING.md for development setup, project structure, and release process.