Files
alexa-amundson-resume/.github/workflows/self-healing.yml
Claude 20232bfd69 feat: add real Stripe integration, e2e tests, and Pi deployment
Replace documentation-only repo with working code:

- Stripe integration: webhook handler (8 event types), billing API
  (customers, checkout, payments, subscriptions, invoices)
- Express API server with health endpoint, structured logging
- E2E tests (Playwright): health, webhook signature verification,
  billing API validation
- Unit tests: webhook event handler coverage for all event types
- Pi deployment: deploy.sh (rsync + systemd), NGINX load balancer
  across Pi cluster, Docker support
- CI/CD: test workflow, Pi deploy workflow, updated auto-deploy
  and self-healing to run real tests before deploying
- Move resume docs to docs/ to separate code from documentation

https://claude.ai/code/session_01Mf5Pg82fV6BTRS9GnpV7nr
2026-03-04 09:00:51 +00:00

82 lines
2.6 KiB
YAML

name: Self-Healing
on:
schedule:
- cron: '*/30 * * * *'
workflow_dispatch:
workflow_run:
workflows: ["Auto Deploy"]
types: [completed]
jobs:
monitor:
name: Monitor Deployments
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Health
id: health
run: |
if [ -n "${{ secrets.DEPLOY_URL }}" ]; then
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "${{ secrets.DEPLOY_URL }}/api/health" || echo "000")
echo "status=$STATUS" >> $GITHUB_OUTPUT
else
echo "status=skip" >> $GITHUB_OUTPUT
fi
- name: Auto-Rollback
if: steps.health.outputs.status != '200' && steps.health.outputs.status != 'skip'
run: |
echo "Health check failed (Status: ${{ steps.health.outputs.status }})"
echo "Triggering rollback..."
gh workflow run auto-deploy.yml --ref $(git rev-parse HEAD~1) || true
env:
GH_TOKEN: ${{ github.token }}
- name: Create Issue on Failure
if: steps.health.outputs.status != '200' && steps.health.outputs.status != 'skip'
uses: actions/github-script@v7
with:
script: |
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'deployment,auto-generated',
state: 'open',
});
if (issues.data.length < 3) {
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Self-Healing: Health Check Failed (Status: ${{ steps.health.outputs.status }})',
body: `Health check failed.\n\nStatus: ${{ steps.health.outputs.status }}\nWorkflow: ${context.workflow}\nRun: ${context.runId}\nTimestamp: ${new Date().toISOString()}`,
labels: ['bug', 'deployment', 'auto-generated']
});
}
dependency-updates:
name: Auto Update Dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
if: hashFiles('package.json') != ''
with:
node-version: '20'
- name: Update npm dependencies
if: hashFiles('package.json') != ''
run: |
npm update
if [ -n "$(git status --porcelain)" ]; then
git config user.name "BlackRoad Bot"
git config user.email "bot@blackroad.io"
git add package*.json
git commit -m "chore: auto-update dependencies"
git push
fi