Lesson 3: CI/CD Integration
Overview
Section titled “Overview”Running ReArch manually is fine for one-off tasks, but the real power comes from automation. In this lesson, you will wire ReArch into your CI/CD pipeline so tasks are triggered automatically by events like new issues, failed tests, or scheduled maintenance.
GitHub Actions Integration
Section titled “GitHub Actions Integration”Add the ReArch GitHub Action to your workflow:
name: ReArch Agent
on: issues: types: [labeled] schedule: - cron: "0 9 * * 1" # Every Monday at 9am
permissions: contents: write pull-requests: write issues: read
jobs: rearch: runs-on: ubuntu-latest if: github.event.label.name == 'rearch' || github.event_name == 'schedule' steps: - uses: actions/checkout@v4
- name: Run ReArch uses: lab34-es/rearch-action@v1 with: api_key: ${{ secrets.REARCH_API_KEY }} task: | ${{ github.event.issue.title }} ${{ github.event.issue.body }} pipeline: feature create_pr: trueHow It Works
Section titled “How It Works”- A team member creates an issue and adds the
rearchlabel - The GitHub Action triggers and passes the issue title + body as the task description
- ReArch processes the task and creates a pull request
- The team reviews and merges as normal
Scheduled Tasks
Section titled “Scheduled Tasks”Use the schedule trigger for recurring maintenance:
# Weekly dependency updates- name: Run ReArch uses: lab34-es/rearch-action@v1 with: api_key: ${{ secrets.REARCH_API_KEY }} task: "Update all npm dependencies to their latest compatible versions. Run tests and fix any breaking changes." pipeline: maintenanceQuality Gates
Section titled “Quality Gates”Prevent the agent from creating PRs that do not meet your standards:
pipeline: name: feature gates: - name: tests command: "npm test" required: true
- name: lint command: "npm run lint" required: true
- name: type-check command: "npx tsc --noEmit" required: true
- name: coverage command: "npm run test:coverage" threshold: 80 required: false # Warn but don't block
- name: bundle-size command: "npm run build && npx bundlesize" required: falseIf a required gate fails, the agent will attempt to fix the issue and re-run. After 3 failed attempts, the task is marked as needs_review and you are notified.
Notifications
Section titled “Notifications”Configure notifications for task lifecycle events:
notifications: slack: webhook: ${{ SLACK_WEBHOOK_URL }} events: - task_completed - task_failed - pr_created - gate_failed
email: recipients: - team@example.com events: - task_failedGitLab CI Integration
Section titled “GitLab CI Integration”ReArch also works with GitLab CI:
rearch: image: lab34/rearch-runner:latest stage: automation rules: - if: '$CI_PIPELINE_SOURCE == "trigger"' script: - rearch task create --description "$TASK_DESCRIPTION" --pipeline feature - rearch task wait --timeout 30m variables: REARCH_API_KEY: $REARCH_API_KEYWebhook API
Section titled “Webhook API”For custom integrations, use the webhook API:
curl -X POST https://api.rearch.engineer/v1/tasks \ -H "Authorization: Bearer $REARCH_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "project": "my-project", "description": "Fix the failing test in auth.test.ts", "pipeline": "bugfix", "callback_url": "https://my-app.com/webhooks/rearch" }'The callback URL receives status updates as the task progresses.
Course Summary
Section titled “Course Summary”You have completed the Advanced AI Workflows course. You now know how to:
- Write custom system prompts that encode your team’s standards
- Coordinate agents across multiple repositories and monorepos
- Automate tasks through CI/CD pipelines with quality gates and notifications
Recommended Next Steps
Section titled “Recommended Next Steps”- Team Collaboration — Set up ReArch for your entire engineering team
- API Reference — Full API documentation for custom integrations