Overview

Overview

Learn how to create TypeScript workflows in Pandaci.

PandaCI uses Deno to run our TypeScript workflows. You don't need to know anything about Deno to get started.

Read our Quick Start guide to learn how to create a new project and write your first workflow.

Creating a workflow

To create a workflow, you need to create a file with the .workflow.ts extension in the .pandaci directory. This file will contain your workflow code.

Here's an example of a simple workflow:

.pandaci/hello-world.workflow.ts
import { docker, $, job, env } from "jsr:@pandaci/workflow";

// Creates a docker task on a 4-core machine
// same as wrapping with `job("some-name", () => { ... })`
docker("ubuntu:latest", { name: "hello world" }, () => {
  // Runs a shell command
  $`echo "Hello, world! from branch: ${env.PANDACI_BRANCH}"`;
});

// Creates 2 docker tasks on an 2-core machine
job("Job 2", { runner: "ubuntu-2x" }, async () => {
  let files = '';
  await docker("ubuntu:latest", async () => {
    // Runs the command in the .pandaci directory
    // and stores the output as a string
    files = await $`ls`.cwd(".pandaci").text();
  });
  docker("ubuntu:latest", () => {
    // we can easily share data between tasks or even jobs
    $`echo "files from another task: ${files}"`;
  });
});

We'll treat any files inside the .pandaci directory with the .workflow.ts extension as a workflow file. You can create as many workflow files as you need.

We recommend you keep any related files inside the .pandaci directory. This will help you keep your project organized.

Workflow configuration

We allow you to export a configuration object from your workflow file. This lets you configure things like triggers or the name of the workflow.

Learn more about the configuration object in the Configuration section.