This is an example of how to setup Momentic tests to run on every pull request and commit to main using GitHub Actions. Make sure to set the MOMENTIC_API_KEY secret in your repository settings.

test.yml
name: Test

env:
  MOMENTIC_API_KEY: ${{ secrets.MOMENTIC_API_KEY }}

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  run-tests:
    name: Run tests
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 20

      - name: Install dependencies
        run: npm install

      - name: Install browsers
        run: npx momentic install-browsers

      - name: Run Momentic tests
        run: npx momentic run ./momentic --start "npm run start" --wait-on http://localhost:3000