Skip to content

Continuous Integration

Wiring taskless check into CI runs your rules automatically on every push and pull request. Add a check step to your existing pipeline. The patterns here translate to any CI system.

  • Full scan: node .taskless/bin/cli.mjs check. Scans everything. Best for runs on your main branch.

  • Diff scan: check only the files that changed. Faster for pull-request builds:

    Terminal window
    node .taskless/bin/cli.mjs check $(git diff --name-only "origin/$TARGET_BRANCH...HEAD")

check skips paths that don’t exist and names them in a notice, so raw git diff --name-only output can pipe in directly. Run it from the repository root. A good default is a diff scan on pull requests and a full scan on pushes to main.

CI runs the project launcher the installer wrote, as node .taskless/bin/cli.mjs, never through npx, pnpm dlx, yarn dlx, or bunx. The launcher runs exactly the CLI version .taskless/taskless.json records, and any other version refuses to run in the project with CLI_VERSION_MISMATCH. node <path> rather than ./<path>, because a CI checkout can lose the executable bit and a Windows runner ignores the shebang.

The job needs Node and nothing else. A repository with no package.json does not need one, and @taskless/cli does not belong in your dependencies.

The launcher’s first run of a version installs it into .taskless/.cache/ from the lockfile beside it, .taskless/bin/cli.lock.json. Cache that directory between runs, keyed on the runner’s operating system and the lockfile’s hash: the key changes exactly when you upgrade.

name: Taskless
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: actions/cache@v4
with:
path: .taskless/.cache
key: taskless-${{ runner.os }}-${{ hashFiles('.taskless/bin/cli.lock.json') }}
- name: Taskless check
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
git fetch origin "${{ github.base_ref }}" --depth=1
FILES=$(git diff --name-only "origin/${{ github.base_ref }}...HEAD")
if [ -z "$FILES" ]; then
echo "No changed files."
exit 0
fi
node .taskless/bin/cli.mjs check $FILES
else
node .taskless/bin/cli.mjs check
fi

The same shape (checkout with full history, set up Node, cache the launcher’s install, run a conditional check) translates to GitLab CI, CircleCI, Jenkins, Azure Pipelines, Bitbucket, and others. For the full per-CI recipe, ask your agent to “add taskless to CI”, or run ./.taskless/bin/cli.mjs agent ci.

GitHub Actions sets CI=true, so the job log shows only error-severity findings, followed by a count of what it left out. Add --include-warnings to the check command to see the rest.

taskless check needs no authentication by default. Your sg and vale rules always run in CI with no secrets. Runtime rules, which execute a check.ts, are skipped in an unauthenticated job. They are reported rather than failed, so an unauthenticated pipeline stays green on them.

To turn CI into the enforcement point, expose a TASKLESS_TOKEN secret. An authenticated check verifies every file of every rule Taskless issued, runs exactly the server-blessed runtime rules, and fails on an issued sg or vale rule that was edited, so a rule loosened to let its own violation through cannot pass CI:

- name: Taskless check
env:
TASKLESS_TOKEN: ${{ secrets.TASKLESS_TOKEN }}
run: |
# ...same check step as above

This is what makes CI the backstop: local developer runs skip runtime rules unless they pass --dangerously-run-scripts, but an authenticated CI job runs the verified set on every change. See Security for the full model.

If your organization’s plan does not include runtime rules, an authenticated job fails until it does. Do not add --anonymous or --dangerously-run-scripts to get green; both hide that the rules are not running.