Skip to main content

Code Examples

Real-world integration examples for common AI use cases.

Examples

GitHub Actions CI/CD

Automated compliance scans on every push (Available Today)

GitHub Actions YAML
# .github/workflows/haiec-compliance.yml
name: HAIEC Compliance Scan

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

jobs:
  compliance:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      
      - name: HAIEC Security Scan
        uses: haiec/scan-action@v1
        with:
          api-key: ${{ secrets.HAIEC_API_KEY }}
          framework: SOC2
          fail-on-critical: true
      
      - name: Upload Results
        if: always()
        uses: actions/upload-artifact@v3
        with:
          name: haiec-scan-results
          path: haiec-results.json
Bash / cURL
# Alternative: Direct API call
curl -X POST https://haiec.com/api/ci/scan \
  -H "Authorization: Bearer $HAIEC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "repoUrl": "github.com/org/repo",
    "branch": "main",
    "framework": "SOC2",
    "commitSha": "'$GITHUB_SHA'"
  }'

# Store artifacts
curl -X POST https://haiec.com/api/ci/artifacts \
  -H "Authorization: Bearer $HAIEC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "scanId": "scan_123",
    "artifactType": "AI_SECURITY_ATTESTATION",
    "data": {...}
  }'