Skip to main content

exec

v2.0.0

The moon exec (or moon x, or moonx) command is a low-level command for executing tasks in the action pipeline. It provides fine-grained control over how tasks are selected and executed, through command line options, making it ideal for custom workflows and advanced use cases.

The moon check, moon ci, and moon run commands are all built on top of moon exec, so be sure to check those out for more user-friendly abstractions!

# Run `lint` in project `app`
$ moon exec app:lint
$ moonx app:lint

# Run `dev` in project `client` and `server`
$ moon exec client:dev server:dev
$ moonx client:dev server:dev

# Run `test` in all projects
$ moon exec :test
$ moonx :test

# Run `test` in all projects with tag `frontend`
$ moon exec '#frontend:test'
$ moonx '#frontend:test'

# Run `format` in the default project
$ moon exec format
$ moonx format

# Run `build` in projects matching the query
$ moon exec :build --query "language=javascript && projectLayer=library"

Arguments

Options

  • -f, --force - Force run and bypass cache, ignore changed files, and skip affected checks.
  • -i, --interactive - Run the pipeline and tasks interactively.
  • -s, --summary [LEVEL] - Print a summary of all actions that were ran in the pipeline.

Workflow

  • --on-failure <ON> - When a task fails, either bail the pipeline, or continue executing.
  • --only-ci-tasks - Filter tasks to those that only run in CI.
  • --query <QUERY> - Filter tasks based on the result of a query.
  • --no-actions - Run the pipeline without sync and setup related actions.

Affected

  • --affected [BY] - Only run tasks if affected by changed files. Optionally accepts "local" or "remote".
  • --base <BASE> - Base branch, commit, or revision to compare against.
  • --head <HEAD> - Current branch, commit, or revision to compare with.
  • --status <STATUS> - Filter changed files based on a changed status.
  • --stdin - Accept changed files from stdin for affected checks.

Graph

  • --downstream <DEPTH>, --dependents <DEPTH> - Control the depth of downstream dependents.
  • --upstream <DEPTH>, --dependencies <DEPTH> - Control the depth of upstream dependencies.

Parallelism

  • --job <INDEX> - Index of the current job (0 based).
  • --job-total <TOTAL> - Total amount of jobs to run.