turbo_task

One package task in a native Turborepo workspace.

Description#

turbo_task represents a single package and task pair from turbo's task graph. Struo hashes its declared inputs, schedules it against the resolved graph, and runs the package script directly from the package directory through a POSIX shell on Linux and macOS, or cmd.exe on Windows. The task's PATH holds the node_modules/.bin directories from the package directory through the workspace root, the directories of Node.js and of the workspace's package manager (from the root packageManager field or the lockfile), and the system directories. It does not include your shell's PATH, so changing it does not invalidate cached tasks. List PATH in turbo.json passThroughEnv to pass it through; it then becomes part of the cache key. HOME is likewise only passed when turbo.json lists it. Package manager lifecycle hooks such as prebuild are not run.

Most attributes are filled in by the turbo_workspace resolver. Declaring a turbo_task by hand is only necessary when the workspace is not covered by the turbo native project.

Inputs are the files of every directory in source_dirs, excluding every task's declared outputs, node_modules, and .turbo; the workspace configuration files in config and global_inputs; the installed packages in dependencies and in each source directory's node_modules; and the output snapshots of upstream tasks, transitively. An empty source_dirs entry selects the whole workspace.

Turborepo outputs are cache patterns, not required products. After a successful run, Struo stores the existing matches in a task-owned snapshot, honoring ! negations, and restores them to their original workspace paths. Absent outputs are valid. With cache set to false, the task runs on every build and its outputs are neither snapshotted nor restored.

The action needs no command filesystem setup or stream redirection, and unpacks missing upstream outputs from their snapshots before running, so any execution provider can run it with struo build --remote.

Attributes#

AttributeTypeRequiredDefaultDescription
packagestringyesWorkspace package name, or // for a root task
taskstringyesTurborepo task name, such as build, test, or lint
commandstringyesThe package script the task runs, executed through the platform shell from package_dir
package_dirstringnoWorkspace-relative package directory; empty for the workspace root
outputslist<string>no[]Workspace-relative output globs, with ! negations. Existing matches are cached and restored; absent outputs are valid
cacheboolnotrueFalse when turbo.json disables caching; the action always runs and its outputs are not restored
source_dirslist<string>no[]Workspace-relative directories whose files are inputs: the package and its internal workspace dependencies. An empty string selects the whole workspace
other_packageslist<string>no[]Workspace packages outside source_dirs; their node_modules links are left out of the inputs
workspace_outputslist<string>no[]Resolver-owned output globs of every task, excluded from source inputs
global_inputslist<string>no[]Workspace-relative files from globalDependencies
nodestringnonodeNode.js executable that runs the task wrapper
dependencieslist<string>no["node_modules/**/*"]Installed package files required at execution time; each source directory's node_modules is added
configlist<string>noroot package.json, lockfiles, turbo.json, turbo.jsonc, pnpm-workspace.yaml, .yarnrc.yml, .npmrc, and tsconfig*.jsonWorkspace-level configuration inputs
envmap<string, string>no{}User-supplied environment variables applied last
env_inheritlist<string>no[]Host environment variables inherited by name, from env, passThroughEnv, and their global forms

Providers#

The target emits turbo_task.

Capabilities#

CapabilityOutput groups
buildnone

Example#

bash
struo query example turbo_task turbo-task struo build greeting__build

Sources#