Skip to content

Third-Party Actions ​

A third-party action is an action package kept outside the dagucloud organization: a Git repository with a dagu-action.yaml manifest and a workflow. Use one when a reusable unit has its own scripts, tools, or several steps, and several workflows or teams should share it at a pinned version.

For a small wrapper around one built-in step, a custom action in YAML is enough.

Call an Action ​

yaml
steps:
  - id: checksum
    action: acme/file-checksum@v1.0.0
    with:
      path: /backups/db.dump

  - id: record
    depends: checksum
    run: echo "${steps.checksum.outputs.sha256}" > /backups/db.dump.sha256

owner/repo@version fetches github.com/owner/repo. For another Git host or a private server, use a Git URL:

yaml
steps:
  - id: checksum
    action: source:https://git.example.com/ops/file-checksum.git@v1.0.0
    with:
      path: /backups/db.dump

The version is required. Pin a tag you trust or a full commit SHA, since the package runs with the same access as any step on the host. Private repositories use the git credentials of the account that runs Dagu. See References.

Build a Package ​

The package below backs the acme/file-checksum call above.

  1. Lay out the repository.

    text
    file-checksum/
    ├── dagu-action.yaml
    └── workflow.yaml
  2. Write the manifest. It names the workflow and the schemas for input and output.

    yaml
    apiVersion: v1alpha1
    name: file-checksum
    dag: workflow.yaml
    inputs:
      type: object
      additionalProperties: false
      required: [path]
      properties:
        path:
          type: string
    outputs:
      type: object
      additionalProperties: false
      required: [sha256]
      properties:
        sha256:
          type: string
  3. Write the workflow. Each with: field arrives as a parameter. stdout.outputs returns stdout as the sha256 output.

    yaml
    params:
      - path
    
    steps:
      - id: hash
        run: sha256sum "${params.path}" | cut -d ' ' -f 1
        stdout:
          outputs: sha256
  4. Test it from a local checkout. A source: path runs the directory as is, without a commit or tag:

    yaml
    steps:
      - id: checksum
        action: source:/home/dev/file-checksum@local
        with:
          path: /tmp/sample.txt
  5. Tag and push. Run git tag v1.0.0 and git push origin v1.0.0. Callers can now use acme/file-checksum@v1.0.0.

Package Rules ​

RuleDetails
Manifest keysOnly apiVersion (must be v1alpha1), name, dag, inputs, outputs.
No working_dirThe workflow runs in a copy of the package, so relative paths point into it.
ToolsDeclare CLIs in the workflow's tools. The caller's tools are not passed in.
SizeUp to 64 MiB compressed, 256 MiB uncompressed, and 8192 files. No symlinks. .git is left out.
OutputsPublish with stdout.outputs, outputs.write, or object-form output:. The result must match outputs.

Action Package Execution explains each rule, how inputs arrive, and how failures surface.

Dagu is open source under the GNU General Public License v3.0.