package.json:
package.json
.github/workflows/ci.yml in your repository with the
following contents:
ci.yml
Authentication
To run any commands, you must authenticate with Momentic. Add theMOMENTIC_API_KEY environment variable to your GitHub Actions workflow.
- Create an API key in the Momentic dashboard.

- Go to your GitHub repository settings and click Secrets, then
Actions. Create a new secret called
MOMENTIC_API_KEYand enter your API key.


- At the top of your GitHub Actions workflow, provide the following environment
variables to jobs that use
momentic:
ci.yml
Gate a pull request from a coding agent
A pull request that Copilot, Cursor, Claude Code, or Devin opened goes through the same job as a pull request a person opened. The agent does not write the end-to-end tests by hand: the tests already live in the repository as YAML, and the job runs them against the branch. A failed test returns a nonzero exit code, so the check fails and the merge stays blocked until the agent or a reviewer fixes the code. Keep the gate small and strict. Label the flows whose failure should block a merge withcritical, run only those on pull_request, and upload the results
so the failed check links to the step that failed, its video, and its trace:
.github/workflows/agent-gate.yml
--labels criticallimits the gate to the labeled tests, so the check finishes in minutes.--reporter stepslogs each step as it starts and finishes. An agent that reads the job log sees the step that failed without opening the dashboard.--upload-resultsattaches the run to the dashboard, where the failed step holds the video and the trace.
Agent gate / Critical flows) to the branch protection’s
required status checks. Until then, the gate is advisory and an agent can merge
over a failure.
When the agent runs in your editor with the
MCP server installed, it runs the same tests before
it pushes, reads the failure, and corrects its own code. The CI job is the
second check on the pull request, not the first place the agent sees a failure.
See
Gate pull requests on critical flows
for the label conventions and the flake policy.
Run mobile tests on a pull request
iOS and Android tests run withmomentic-mobile, one workflow per platform.
Remote simulators and emulators run on Momentic, so the test job needs no macOS
runner and no Xcode. Only the build step needs macOS, because the iOS testing
build is an .app bundle from Xcode. Upload the build once, then run the iOS
tests against it:
.github/workflows/ios.yml
--channel pr --tag $ASSET_TAGinstalls the build this pull request produced, so the tests never run against a stale app. Tags are immutable: a(channel, tag)accepts only the same bytes again. A tag built fromgithub.sha,github.run_id, andgithub.run_attemptis new on every run and every rerun, so a rebuilt app never collides with an earlier upload.tests/ioslimits the run to the iOS tests. Without a path or--includepattern,momentic-mobile runcollects the Android tests too, and they fail because no APK exists under this channel and tag.--parallel AUTOruns the tests at the same time. Each remote test gets its own simulator or emulator, so parallelism is safe and the run is as long as the slowest test.- An Android build follows the same shape in its own workflow: build the APK on
ubuntu-latest, upload it withassets upload, and runtests/androidwith the same--channeland--tag.
momentic-mobile assets for
channels and tags.
Sharding
If you have a large test set, use sharding to run tests in parallel across CI jobs and shorten total run time. To shard your tests, pass the--shard-index and --shard-count options to the
momentic run command. --shard-index is the index of the current shard
(starting from 1), and --shard-count is the total number of shards.
To collect test results inside a single run group in the Momentic dashboard, add
a separate step after all tests complete to merge and upload results.
ci.yml