Detect CI
Momentic auto-detects CI by reading CI=true. If your provider doesn’t set it,
set it yourself so all CI-related defaults kick in.
Saving caches
Momentic doesn’t save caches on the configured main branch by default (avoids
pollution from local runs). Supported CI providers (GitHub Actions, GitLab CI,
Travis CI) override this automatically. On custom setups, pass --save-cache to
enable cache saving:
npx momentic run --save-cache [options] [tests...]
Always save caches in CI. See Step cache for how
caching works.
Momentic collects git metadata to power cache isolation, run traceability, and
status posts. It reads metadata via the git CLI or provider-specific handling.
If your CI runner doesn’t have git or runs in a shallow state, provide metadata
yourself via env vars.
For best cache performance, provide at minimum GIT_BRANCH_NAME,
GIT_COMMIT_SHA, GIT_COMMIT_TIMESTAMP, LAST_COMMIT_ON_MAIN_SHA,
LAST_COMMIT_ON_MAIN_TIMESTAMP, and if possible MERGED_GIT_BRANCH_NAME.
MOMENTIC_GIT_OVERRIDE=true: must be set to enable git metadata overrides
GIT_COMMIT_SHA: the full commit SHA
GIT_COMMIT_SHA_SHORT: the short commit SHA (if not provided, this will be
derived from the full SHA)
GIT_COMMIT_TIMESTAMP: the current commit timestamp in ISO 8601 format
GIT_BRANCH_NAME: the current branch name
GIT_ORIGIN_URL: the git origin URL
GIT_COMMIT_AUTHOR_NAME: the commit author’s name
GIT_COMMIT_MESSAGE: the commit message
LAST_COMMIT_ON_MAIN_SHA: the full commit SHA of the last commit on main.
When using git, this is the output of running git merge-base main HEAD. On
main, this is the current commit SHA.
LAST_COMMIT_ON_MAIN_TIMESTAMP: the commit timestamp of
LAST_COMMIT_ON_MAIN_SHA in ISO 8601 format.
MERGED_GIT_BRANCH_NAME: when on main, the name of the branch that was merged
to create the current commit. This is usually derived from pull/merge requests
using our GitHub/GitLab integrations.
GITHUB_REPOSITORY: the GitHub repository name in the format owner/repo (if
applicable)
GITLAB_PROJECT_PATH: the GitLab project path in the format
group/subgroup/repo (if applicable)
GIT_USERNAME: the username of the current git user (if applicable)
GIT_EMAIL: the email of the current git user (if applicable)
GIT_NAME: the name of the current git user (if applicable)