Skip to main content

GitHub Actions

Dagger provides a GitHub Action that runs dagger check in any GitHub Actions workflow, so the same checks you run locally run on every push — without rewriting your pipeline.

tip

For checks with no workflow YAML at all, enable Cloud Checks with dagger ws autocheck on. The GitHub Action below is the hybrid-mode alternative for when you want to drive Dagger from your existing GitHub Actions setup.

How it works​

  1. GitHub receives a workflow trigger based on a repository event.
  2. GitHub runs the dagger/dagger-for-github action.
  3. The action installs the Dagger CLI and runs dagger check against the modules installed in your workspace.
  4. The CLI finds an existing Dagger Engine or starts one in the runner, and sends telemetry to Dagger Cloud if a Cloud token is configured.
  5. The workflow succeeds or fails based on the check results. Logs appear in GitHub as usual.

Prerequisites​

  • A GitHub repository with a Dagger workspace (.dagger/config.toml) — see Workspace Setup.

Example​

Run all checks on every push and pull request:

.github/workflows/dagger.yml
name: dagger
on:
push:
pull_request:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Dagger checks
uses: dagger/dagger-for-github@v8.4.0
with:
check: "**"
version: "latest"

The check input takes the same patterns as the CLI, so you can scope it — for example check: "go:*" to run a single module's checks. As a convenience for the common case, the dagger/checks action wraps this step.

Dagger Cloud​

To send traces to Dagger Cloud and offload execution to a managed Dagger Engine, add your Cloud token:

  1. In Dagger Cloud, open the settings page (cogwheel icon) → Tokens and copy a token (URL pattern: https://dagger.cloud/{Your Org Name}/settings?tab=Tokens).
  2. In your GitHub repository, go to Settings > Secrets and variables > Actions, click New repository secret, name it DAGGER_CLOUD_TOKEN, and paste the token.
  3. Pass it to the action with the cloud-token input:
.github/workflows/dagger.yml
      - name: Run Dagger checks
uses: dagger/dagger-for-github@v8.4.0
with:
check: "**"
version: "latest"
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}

Dagger Cloud Engines​

By default the action starts a Dagger Engine inside the GitHub Actions runner. For a faster, more reliable experience, offload execution to a managed Dagger Engine provided by Dagger Cloud by adding --cloud to dagger-flags:

.github/workflows/dagger.yml
      - name: Run Dagger checks
uses: dagger/dagger-for-github@v8.4.0
with:
check: "**"
version: "latest"
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
dagger-flags: "--cloud"

Cloud Engines provide a large persistent cache shared across runs and far more compute than a GitHub Actions runner, so checks are typically much faster — and you don't provision or maintain any infrastructure. This requires the DAGGER_CLOUD_TOKEN secret configured above.

SSH configuration​

When using SSH keys in GitHub Actions, ensure proper SSH agent setup:

- name: Set up SSH
run: |
eval "$(ssh-agent -s)"
ssh-add - <<< '${{ secrets.SSH_PRIVATE_KEY }}'

Replace ${{ secrets.SSH_PRIVATE_KEY }} with your provider secret containing the private key.

Resources​

If you have any questions about additional ways to use GitHub with Dagger, join our Discord and ask your questions in our GitHub channel.

About GitHub​

GitHub is a popular Web-based platform used for version control and collaboration. It allows developers to store and manage their code in repositories, track changes over time, and collaborate with other developers on projects.