Embedding is easy
Embedding Dagger in a GitHub Action workflow is straightforward as the Dagger team provides a GitHub Action that you can use to run Dagger pipelines.
Alternatively, the proces is the same as what we just did, if you do not want to use the provided GitHub Action.
Dagger, GitHub and a runner
To run a Dagger pipeline in a GitHub Action workflow, you need to create a new workflow file in your repository and add the necessary steps to run the pipeline.
This eventually means running the Dagger workflow inside the GitHub workflow.
The general outline of how Dagger, GitHub workflows and GitHub runners work together looks like this:
In more detail
GitHub Action Workflow
Create a new file in the .github/workflows
directory called dagger.yml
and add the following content:
name: Run Dagger pipeline
on:
push:
branches:
- main
workflow_dispatch:
jobs:
dagger:
name: Run Dagger pipeline
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23.3
cache: false
- name: Run Dagger pipeline
uses: dagger/dagger-for-github@v6
with:
workdir: go
verb: run
args: go run pipeline.go
version: "0.14.0"
This workflow runs on every push to the main
branch and when manually triggered.
It uses the dagger/dagger-for-github
action to run the pipeline.
Push the changes to your repository and navigate to the Actions tab in GitHub to see the workflow running.