Skip to content

GitHub Actions

Add the API key as a repository secret named MAILCATCHR_API_KEY. The mailbox id and any authenticator id are not sensitive and can be repository variables.

name: e2e
on: [push, pull_request]
jobs:
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npx playwright install --with-deps chromium
- run: npx playwright test
env:
MAILCATCHR_API_KEY: ${{ secrets.MAILCATCHR_API_KEY }}
MAILCATCHR_MAILBOX_ID: ${{ vars.MAILCATCHR_MAILBOX_ID }}
MAILCATCHR_TOTP_ID: ${{ vars.MAILCATCHR_TOTP_ID }}

Several pipelines can share one mailbox as long as every test uses a unique recipient address and filters on it. Include something run-specific in the local part so a re-run of the same commit does not match mail from the first attempt:

const address = `signup-${process.env.GITHUB_RUN_ID}-${process.env.GITHUB_RUN_ATTEMPT}-${Date.now()}@acme-ci.mailcatchr.com`;

On the Business plan you can also create a mailbox per pull request over the API and delete it afterwards. See Mailboxes and addresses.

A key may make 100 requests a minute. A suite that waits on mail makes one request per wait, so this is rarely reached. If it is, give each pipeline its own key; the workspace allows 1,000 a minute in total.