Skip to content
Latchkey

Task: Skip Up-to-Date Tasks with sources and status

Task skips a task when its sources have not changed or a status check already passes.

Like make, Task can avoid redundant work. Declaring sources and generates lets it fingerprint inputs; a status command lets you write your own up-to-date test.

What it does

When a task lists sources (input files) and generates (output files), Task fingerprints them and skips the task if nothing changed. Alternatively, a status list of shell commands marks the task up-to-date when all of them exit zero. The method key selects checksum, timestamp, or none. --force runs the task regardless.

Common usage

Taskfile.yml
# Taskfile.yml
version: '3'

tasks:
  build:
    sources:
      - '**/*.go'
    generates:
      - bin/app
    cmds:
      - go build -o bin/app ./...

  # custom up-to-date test
  migrate:
    status:
      - test -f .migrated
    cmds:
      - ./migrate.sh && touch .migrated
# force a rebuild: task build --force

Syntax

Key / flagWhat it does
sources:Input file globs to fingerprint
generates:Output files the task produces
status:Commands; if all exit 0 the task is up to date
method:checksum (default), timestamp, or none
--force, -fRun even if Task thinks it is up to date
.task/ directoryWhere checksum fingerprints are stored

In CI

Cache the .task directory between runs so Task can skip unchanged builds; without that cache, every fresh runner recomputes from scratch. Use status for steps whose freshness is not just file timestamps, like a database migration marker.

Common errors in CI

A task that never skips on CI usually means the .task fingerprint directory is not cached, so checksums reset each run. A task that wrongly skips means a source file is missing from sources, or method: timestamp saw equal mtimes after a checkout (checkouts reset mtimes); prefer method: checksum. Use --force to bypass a stale skip while debugging.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →