> ## Documentation Index
> Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom setups

> Make Momentic behave correctly when running on CI providers without a dedicated guide.

On a CI provider without a dedicated guide, three things need attention so
Momentic behaves the same as it does on supported providers: CI detection, cache
saving, and git metadata. Work through each section below.

## 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 apply.

## 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:

<CodeGroup>
  ```bash npm theme={null}
  npx momentic run --save-cache [options] [tests...]
  ```

  ```bash yarn theme={null}
  yarn dlx momentic run --save-cache [options] [tests...]
  ```

  ```bash pnpm theme={null}
  pnpm dlx momentic run --save-cache [options] [tests...]
  ```
</CodeGroup>

<Tip>
  Always save caches in CI. See [Step cache](/reliability/step-cache) for how
  caching works.
</Tip>

## Git metadata

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.

<Tip>
  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`.
</Tip>

* `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)
