Emailens
GitHub Action

Workflow Examples

Example GitHub Actions workflows for common email testing scenarios.

Basic — check all emails on PR

name: Email Preview Check
on: [pull_request]

jobs:
  check-emails:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: emailens/action@v1
        with:
          pattern: "emails/**/*.html"
          threshold: "70"

Strict — high threshold with API key

name: Email Compatibility Gate
on:
  pull_request:
    paths:
      - "src/emails/**"

jobs:
  email-qa:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: emailens/action@v1
        with:
          pattern: "src/emails/**/*.html"
          threshold: "85"
          api-key: ${{ secrets.EMAILENS_API_KEY }}
          fail-on-error: "true"

Top 3 clients only

Check only the most popular email clients:

- uses: emailens/action@v1
  with:
    pattern: "emails/**/*.html"
    threshold: "80"
    clients: "gmail-web,outlook-windows,apple-mail-macos"

Non-blocking — warn but don't fail

- uses: emailens/action@v1
  id: email-check
  with:
    pattern: "emails/**/*.html"
    threshold: "70"
    fail-on-error: "false"

- name: Post results as comment
  if: always()
  uses: actions/github-script@v7
  with:
    script: |
      const summary = '${{ steps.email-check.outputs.summary }}';
      const passed = '${{ steps.email-check.outputs.passed }}';
      const icon = passed === 'true' ? ':white_check_mark:' : ':warning:';
      github.rest.issues.createComment({
        owner: context.repo.owner,
        repo: context.repo.repo,
        issue_number: context.issue.number,
        body: `${icon} **Email Compatibility Report**\n\n${summary}`
      });

Scheduled — weekly full scan

name: Weekly Email Audit
on:
  schedule:
    - cron: "0 9 * * 1"  # Monday 9am UTC

jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: emailens/action@v1
        with:
          pattern: "**/*.html"
          threshold: "60"
          api-key: ${{ secrets.EMAILENS_API_KEY }}

On this page