Skip to main content
Example workflow for running Momentic on GitHub Actions. More reference workflows live in momentic-ai/examples. For a given root package.json:
package.json
Create a file called .github/workflows/ci.yml in your repository with the following contents:
ci.yml

Authentication

To run any commands, you must authenticate with Momentic. You can do this by adding the MOMENTIC_API_KEY environment variable to your GitHub Actions workflow.
  1. Create an API key in Momentic dashboard.
Copy the value; you will add it as a CI secret in the next step.
  1. Go to your GitHub repository settings and click on the Secrets and then Actions tab. Create a new secret called MOMENTIC_API_KEY and enter the value of your API key.
  1. At the top of your GitHub Actions workflow, provide the following environment variables to jobs that use momentic:
ci.yml

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. The 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 Momentic dashboard, you need to add a separate step after all tests complete to merge and upload results.
ci.yml