CI/CD Integration

Integrate onboarding audits into your CI/CD pipeline to automatically check your onboarding experience quality with every deployment.

GitHub Actions Workflow

Basic Workflow

Copy and paste this workflow into your .github/workflows/onboarding-audit.yml file:

name: Onboarding Audit

on:
  pull_request:
    branches: [ main, develop ]
  push:
    branches: [ main ]
  schedule:
    - cron: '0 2 * * 1'  # Weekly on Monday at 2 AM

jobs:
  audit:
    runs-on: ubuntu-latest
    
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      
      - name: Run onboarding audit
        uses: ./.github/actions/run-onbrd
        with:
          url: 'https://your-site.com'
          threshold: '80'
          mode: 'local'
          artifact: 'true'

Advanced Workflow with Multiple Environments

name: Onboarding Audit - Multi-Environment

on:
  pull_request:
    branches: [ main, develop ]
  push:
    branches: [ main ]
  workflow_dispatch:

jobs:
  audit-staging:
    runs-on: ubuntu-latest
    environment: staging
    
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      
      - name: Deploy to staging
        run: |
          # Your staging deployment steps here
          echo "Deployed to staging"
      
      - name: Audit staging
        uses: ./.github/actions/run-onbrd
        with:
          url: 'https://staging.your-site.com'
          threshold: '75'
          mode: 'remote'
          artifact: 'true'

  audit-production:
    runs-on: ubuntu-latest
    environment: production
    needs: audit-staging
    if: github.ref == 'refs/heads/main'
    
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      
      - name: Audit production
        uses: ./.github/actions/run-onbrd
        with:
          url: 'https://your-site.com'
          threshold: '85'
          mode: 'remote'
          artifact: 'true'

Workflow with Comparison

Compare before and after deployments:

name: Onboarding Audit - Comparison

on:
  pull_request:
    branches: [ main ]

jobs:
  compare-audits:
    runs-on: ubuntu-latest
    
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      
      - name: Audit current version
        uses: ./.github/actions/run-onbrd
        with:
          url: 'https://staging.your-site.com'
          threshold: '80'
          mode: 'remote'
          json-output: 'current-audit.json'
          report-output: 'current-report.html'
      
      - name: Checkout main branch
        uses: actions/checkout@v4
        with:
          ref: main
          path: main-branch
      
      - name: Audit main branch version
        uses: ./.github/actions/run-onbrd
        with:
          url: 'https://your-site.com'
          threshold: '80'
          mode: 'remote'
          json-output: 'main-audit.json'
          report-output: 'main-report.html'
      
      - name: Compare reports
        run: |
          cd packages/cli
          npx onbrd compare ../../main-report.html ../../current-report.html --out ../../comparison.html
      
      - name: Upload comparison
        uses: actions/upload-artifact@v4
        with:
          name: audit-comparison
          path: |
            current-audit.json
            current-report.html
            main-audit.json
            main-report.html
            comparison.html

Configuration Options

Input Description Required Default
url URL to audit ✅ Yes -
threshold Minimum score threshold (0-100) No 80
mode Audit mode (local|remote) No local
artifact Upload artifacts (true|false) No true
json-output JSON output filename No audit-results.json
report-output HTML report output filename No audit-report.html

Action Outputs

Output Description Example
score The audit score (0-100) 85
passed Whether the audit passed the threshold true
exit-code Exit code from the audit command 0

Usage Examples

Using Outputs in Subsequent Steps

- name: Run onboarding audit
  uses: ./.github/actions/run-onbrd
  id: audit
  with:
    url: 'https://your-site.com'
    threshold: '80'

- name: Check if audit passed
  if: steps.audit.outputs.passed == 'true'
  run: |
    echo "✅ Audit passed with score: ${{ steps.audit.outputs.score }}"

- name: Alert on failure
  if: steps.audit.outputs.passed == 'false'
  run: |
    echo "❌ Audit failed with score: ${{ steps.audit.outputs.score }}"
    exit 1

Conditional Deployment

- name: Run onboarding audit
  uses: ./.github/actions/run-onbrd
  id: audit
  with:
    url: 'https://staging.your-site.com'
    threshold: '80'

- name: Deploy to production
  if: steps.audit.outputs.passed == 'true'
  run: |
    echo "Deploying to production..."
    # Your deployment commands here

Troubleshooting

Exit Codes

  • 0: Audit passed (score >= threshold)
  • 1: Audit failed (score < threshold)
  • 2: Integrity check failed

Common Issues

  • Timeout errors: Increase timeout in your workflow or check if the site is accessible
  • Low scores: Review the generated HTML report for specific recommendations
  • Artifact upload failures: Ensure your repository has sufficient storage quota

Next Steps

  • Customize the threshold based on your quality standards
  • Set up scheduled audits for regular monitoring
  • Integrate with your deployment pipeline
  • Use the comparison feature to track improvements over time
  • Set up alerts for audit failures