GitHub Actions
The setup-dagu action installs Dagu on a GitHub Actions runner.
Install
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dagucloud/setup-dagu@v1
- run: dagu versionIt installs the latest release on Linux, macOS, and Windows runners. To pin a release, set version under with. See the setup-dagu README for its inputs and outputs.
Run a DAG on a Schedule
# .github/workflows/nightly.yml
name: nightly
on:
schedule:
- cron: "0 2 * * *"
workflow_dispatch:
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dagucloud/setup-dagu@v1
- run: dagu start workflows/nightly.yamlThe job fails when the DAG fails.
Steps run in a per-run work directory. If they call scripts from the repository, set working_dir: .. in workflows/nightly.yaml so they run from the repository root.
Monitor Runs in Dagu Console
GitHub shows the whole DAG as one step. With a run key, each run also reports to Dagu Console, which gives you:
- the status, duration, and retries of every step
- an alert when a run fails, or when the runner disappears mid-run
- an alert when a scheduled run is late or never runs, which GitHub can do under load (needs a plan)
- one run history across all your repositories
To set it up:
- In Console, open Servers and create a run key under Jobs.
- Save it as a repository secret named
DAGU_CLOUD_RUN_KEY. - Pass it to the step that runs the DAG:
- run: dagu start workflows/nightly.yaml
env:
DAGU_CLOUD_RUN_KEY: ${{ secrets.DAGU_CLOUD_RUN_KEY }}Logs stay on GitHub, and Console links to each run. To include the failed steps' error messages in alerts, also set DAGU_CLOUD_REPORT: errors. The first 1,000 runs a month are free. See Job Runs for details.
Test DAGs on Pull Requests
# .github/workflows/dagu-test.yml
name: dagu-test
on:
pull_request:
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dagucloud/setup-dagu@v1
- run: dagu test workflows/dagu test runs every test file under workflows/ and fails the job when a case fails. Mocked steps run no commands, so the job needs no secrets unless a case lists a step under real. A step under real runs its command in the job, so the tools it calls must be on the runner. See Workflow Tests.
Show Results on the Pull Request
To see each case as a test result on the pull request, write a JUnit report and pass it to a JUnit reporter, such as action-junit-report:
permissions:
contents: read
checks: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dagucloud/setup-dagu@v1
- run: dagu test --format junit workflows/ > dagu-test.xml
- uses: mikepenz/action-junit-report@v6
if: always()
with:
report_paths: dagu-test.xmlif: always() publishes the report when a case fails. See JUnit report for the format.
Deploy After Merge
Make the test job a required check on main. After a pull request merges, your Dagu servers pick up the change with Git Sync.

