Configure Apollo.io CI/CD integration.
Use when setting up automated testing, continuous integration,
or deployment pipelines for Apollo integrations.
Trigger with phrases like "apollo ci", "apollo github actions",
"apollo pipeline", "apollo ci/cd", "apollo automated tests".
Set up CI/CD pipelines for Apollo.io integrations with GitHub Actions. Uses MSW mocks for unit tests (zero API calls), sandbox tokens for staging, and live API tests gated to main branch only. Apollo's sandbox token returns dummy data without consuming credits.
Prerequisites
GitHub repository with Actions enabled
Apollo master API key + sandbox token
Node.js 18+
Instructions
Step 1: Store Secrets in GitHub
# Master API key for integration tests (main branch only)
gh secret set APOLLO_API_KEY --body "$APOLLO_API_KEY"
# Sandbox token for staging tests (safe, no credits)
gh secret set APOLLO_SANDBOX_KEY --body "$APOLLO_SANDBOX_KEY"
Step 2: GitHub Actions Workflow
# .github/workflows/apollo-ci.yml
name: Apollo CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint-and-typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: '20', cache: 'npm' }
- run: npm ci
- run: npm run lint
- run: npm run typecheck
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: '20', cache: 'npm' }
- run: npm ci
- run: npm test
# Unit tests use MSW mocks — zero API calls
integration-tests:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: '20', cache: 'npm' }
- run: npm ci
- name: Apollo Health Check
env:
APOLLO_API_KEY: ${{ secrets.APOLLO_API_KEY }}
run: |
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-H "x-api-key: $APOLLO_API_KEY" \
"https://api.apollo.io/api/v1/auth/health")
echo "Apollo API: HTTP $STATUS"
[ "$STATUS" = "200" ] || exit 1
- run: npm run test:integration
env:
APOLLO_API_KEY: ${{ secrets.APOLLO_API_KEY }}
secret-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for hardcoded API keys
run: |
if grep -rn 'x-api-key.*[a-zA-Z0-9]\{20,\}' src/ --include='*.ts' --include='*.js'; then
echo "Potential hardcoded API key found!"
exit 1
fi
echo "No hardcoded secrets"