|
1 | 1 | # aieng-bot-maintain |
2 | 2 |
|
3 | | -Centralized maintenance bot for ALL Vector Institute repositories. Automatically manages Dependabot PRs across the entire organization from a single location. |
| 3 | +Centralized maintenance bot that automatically manages Dependabot PRs across all Vector Institute repositories from a single location. |
4 | 4 |
|
5 | 5 | ## Features |
6 | 6 |
|
7 | | -- **Organization-wide monitoring**: Scans all VectorInstitute repos every 10 minutes |
8 | | -- **Auto-merge**: Merges Dependabot PRs when all checks pass |
9 | | -- **Auto-fix**: Fixes test failures, linting issues, security vulnerabilities, and build errors using Gemini 3 AI |
10 | | -- **Centralized operation**: No need to install workflows in each repository |
11 | | -- **Smart detection**: Categorizes failures and applies appropriate fix strategies |
12 | | -- **Transparent**: Comments on PRs with status updates |
| 7 | +**Organization-wide monitoring** - Scans all VectorInstitute repos every 10 minutes |
| 8 | +**Auto-merge** - Merges Dependabot PRs when all checks pass |
| 9 | +**Auto-fix** - Fixes test failures, linting issues, security vulnerabilities, and build errors using Gemini 3 AI |
| 10 | +**Centralized operation** - No installation needed in individual repositories |
| 11 | +**Smart detection** - Categorizes failures and applies appropriate fix strategies |
| 12 | +**Transparent** - Comments on PRs with status updates |
13 | 13 |
|
14 | 14 | ## Architecture |
15 | 15 |
|
@@ -39,147 +39,122 @@ Centralized maintenance bot for ALL Vector Institute repositories. Automatically |
39 | 39 |
|
40 | 40 | ## Quick Start |
41 | 41 |
|
42 | | -### One-Time Setup (in THIS repository) |
| 42 | +### Setup (in this repository) |
43 | 43 |
|
44 | | -1. **Add organization secrets** to this repository: |
45 | | - - `GEMINI_API_KEY`: Get from [Google AI Studio](https://makersuite.google.com/app/apikey) |
46 | | - - `ORG_ACCESS_TOKEN`: GitHub PAT with org-wide access (see below) |
| 44 | +**1. Create Gemini API Key** |
| 45 | +- Get from [Google AI Studio](https://makersuite.google.com/app/apikey) |
| 46 | +- Add as repository secret: `GEMINI_API_KEY` |
47 | 47 |
|
48 | | -2. **Create GitHub Personal Access Token**: |
49 | | - - Go to Settings → Developer settings → Personal access tokens → Fine-grained tokens |
50 | | - - Create token with: |
51 | | - - Resource owner: VectorInstitute |
52 | | - - Repository access: All repositories |
53 | | - - Permissions: `contents: write`, `pull_requests: write`, `issues: write` |
54 | | - - Add as secret: `ORG_ACCESS_TOKEN` |
| 48 | +**2. Create GitHub Personal Access Token** |
| 49 | +- Go to Settings → Developer settings → Personal access tokens → Fine-grained tokens |
| 50 | +- Configure: Resource owner: `VectorInstitute`, Repository access: `All repositories` |
| 51 | +- Permissions: `contents: write`, `pull_requests: write`, `issues: write` |
| 52 | +- Add as repository secret: `ORG_ACCESS_TOKEN` |
55 | 53 |
|
56 | | -3. **Enable workflows** in this repository: |
57 | | - - Actions → Enable workflows |
58 | | - - Workflows will start running automatically |
| 54 | +**3. Enable GitHub Actions** |
| 55 | +- Go to Actions tab → Enable workflows |
59 | 56 |
|
60 | | -4. **That's it!** The bot now monitors all VectorInstitute repos |
| 57 | +The bot now monitors all VectorInstitute repositories automatically. |
61 | 58 |
|
62 | 59 | ## How It Works |
63 | 60 |
|
64 | | -### 1. Monitoring (Every 10 minutes) |
65 | | -`monitor-org-dependabot.yml` runs automatically: |
66 | | -- Scans all VectorInstitute repositories |
67 | | -- Finds open Dependabot PRs |
| 61 | +**1. Monitor** (every 10 minutes) |
| 62 | +- Scans all VectorInstitute repositories for open Dependabot PRs |
68 | 63 | - Checks status of each PR |
69 | | -- Routes to merge or fix workflows |
| 64 | +- Routes to merge or fix workflow |
70 | 65 |
|
71 | | -### 2. Auto-Merge (for passing PRs) |
72 | | -When all checks pass: |
73 | | -- Approves the PR |
74 | | -- Enables auto-merge |
| 66 | +**2. Auto-Merge** (when all checks pass) |
| 67 | +- Approves PR and enables auto-merge |
75 | 68 | - Comments with status |
76 | | -- PR merges automatically when ready |
| 69 | +- PR merges automatically |
77 | 70 |
|
78 | | -### 3. Auto-Fix (for failing PRs) |
79 | | -When checks fail: |
80 | | -- Triggers `fix-remote-pr.yml` workflow |
81 | | -- Clones the target repo + PR branch |
82 | | -- Analyzes failure type (test/lint/security/build) |
| 71 | +**3. Auto-Fix** (when checks fail) |
| 72 | +- Clones target repository and PR branch |
| 73 | +- Analyzes failure type: test, lint, security, or build |
83 | 74 | - Loads appropriate AI prompt template |
84 | 75 | - Invokes Gemini 3 Pro to generate fixes |
85 | | -- Pushes fixes to PR branch |
86 | | -- Comments with results |
| 76 | +- Pushes fixes and comments on PR |
87 | 77 |
|
88 | 78 | ## Configuration |
89 | 79 |
|
90 | | -### Required Secrets |
91 | | -- `GEMINI_API_KEY`: Gemini API access (required) |
92 | | -- `ORG_ACCESS_TOKEN`: GitHub PAT with org-wide permissions (required) |
| 80 | +**Required Secrets** |
| 81 | +- `GEMINI_API_KEY` - Gemini API access |
| 82 | +- `ORG_ACCESS_TOKEN` - GitHub PAT with org-wide permissions |
93 | 83 |
|
94 | | -### Workflows |
95 | | -- `.github/workflows/monitor-org-dependabot.yml` - Scans org for Dependabot PRs |
96 | | -- `.github/workflows/fix-remote-pr.yml` - Fixes failing PRs |
| 84 | +**Workflows** |
| 85 | +- `monitor-org-dependabot.yml` - Scans org for Dependabot PRs every 10 minutes |
| 86 | +- `fix-remote-pr.yml` - Fixes failing PRs using AI |
97 | 87 |
|
98 | | -### AI Prompt Templates |
99 | | -Customize these for your organization's needs: |
100 | | -- `.github/prompts/fix-test-failures.md` |
101 | | -- `.github/prompts/fix-lint-failures.md` |
102 | | -- `.github/prompts/fix-security-audit.md` |
103 | | -- `.github/prompts/fix-build-failures.md` |
| 88 | +**AI Prompt Templates** (customize for your needs) |
| 89 | +- `fix-test-failures.md` - Test failure resolution strategies |
| 90 | +- `fix-lint-failures.md` - Linting/formatting fixes |
| 91 | +- `fix-security-audit.md` - Security vulnerability handling |
| 92 | +- `fix-build-failures.md` - Build/compilation error fixes |
104 | 93 |
|
105 | | -## What It Can Fix |
| 94 | +## Capabilities |
106 | 95 |
|
107 | | -✅ Linting and formatting issues |
108 | | -✅ Security vulnerabilities (dependency updates) |
109 | | -✅ Simple test failures from API changes |
110 | | -✅ Build configuration issues |
| 96 | +**Can fix:** |
| 97 | +- Linting and formatting issues |
| 98 | +- Security vulnerabilities (dependency updates) |
| 99 | +- Simple test failures from API changes |
| 100 | +- Build configuration issues |
111 | 101 |
|
112 | | -❌ Complex logic errors |
113 | | -❌ Breaking changes requiring refactoring |
114 | | -❌ Issues requiring architectural decisions |
| 102 | +**Cannot fix:** |
| 103 | +- Complex logic errors |
| 104 | +- Breaking changes requiring refactoring |
| 105 | +- Issues requiring architectural decisions |
115 | 106 |
|
116 | 107 | ## Manual Testing |
117 | 108 |
|
118 | | -You can manually trigger workflows for specific PRs: |
119 | | - |
| 109 | +**Trigger via CLI:** |
120 | 110 | ```bash |
121 | | -# Test the monitor workflow |
122 | | -gh workflow run monitor-org-dependabot.yml --repo VectorInstitute/aieng-bot-maintain |
| 111 | +# Monitor all repositories |
| 112 | +gh workflow run monitor-org-dependabot.yml |
123 | 113 |
|
124 | | -# Fix a specific PR |
| 114 | +# Fix a specific PR (test with aieng-template-mvp#17) |
125 | 115 | gh workflow run fix-remote-pr.yml \ |
126 | | - --repo VectorInstitute/aieng-bot-maintain \ |
127 | 116 | --field target_repo="VectorInstitute/aieng-template-mvp" \ |
128 | 117 | --field pr_number="17" |
129 | 118 | ``` |
130 | 119 |
|
131 | | -Or use the GitHub UI: |
132 | | -- Actions → Select workflow → Run workflow → Enter parameters |
| 120 | +**Trigger via GitHub UI:** |
| 121 | +Actions → Select workflow → Run workflow → Enter parameters |
133 | 122 |
|
134 | | -## Documentation |
| 123 | +## Monitoring |
135 | 124 |
|
136 | | -- [Setup Guide](SETUP.md): Detailed configuration and permissions |
137 | | -- [Deployment Guide](DEPLOYMENT.md): Rollout strategy and monitoring |
138 | | -- [Testing Guide](TESTING.md): Test cases and validation |
139 | | -- [Bot Identity](/.github/bot-assets/BOT_IDENTITY.md): Avatar and branding specs |
| 125 | +**View bot activity:** |
| 126 | +- Actions tab - All workflow runs and success/failure rates |
| 127 | +- PR comments - Detailed status updates on each PR |
| 128 | +- Run summary - PR count and actions taken per run |
140 | 129 |
|
141 | | -## Test Target |
| 130 | +**Debug commands:** |
| 131 | +```bash |
| 132 | +# View recent workflow runs |
| 133 | +gh run list --workflow=monitor-org-dependabot.yml --limit 5 |
142 | 134 |
|
143 | | -Test with [aieng-template-mvp#17](https://github.com/VectorInstitute/aieng-template-mvp/pull/17): |
144 | | -- Has frontend test failures |
145 | | -- Real Dependabot dependency updates |
146 | | -- Perfect candidate for auto-fix testing |
| 135 | +# View logs for specific run |
| 136 | +gh run view RUN_ID --log |
| 137 | +``` |
147 | 138 |
|
148 | | -## Monitoring |
| 139 | +## Documentation |
149 | 140 |
|
150 | | -View bot activity: |
151 | | -- **Actions tab**: See all workflow runs |
152 | | -- **Workflow runs**: Check success/failure rates |
153 | | -- **PR comments**: Bot leaves detailed status updates |
154 | | -- **Run summary**: Each workflow run shows PR count and actions taken |
| 141 | +- [Setup Guide](SETUP.md) - Detailed configuration and permissions |
| 142 | +- [Deployment Guide](DEPLOYMENT.md) - Rollout strategy and monitoring |
| 143 | +- [Testing Guide](TESTING.md) - Test cases and validation |
| 144 | +- [Bot Identity](/.github/bot-assets/BOT_IDENTITY.md) - Avatar and branding |
155 | 145 |
|
156 | 146 | ## Troubleshooting |
157 | 147 |
|
158 | 148 | | Issue | Solution | |
159 | 149 | |-------|----------| |
160 | | -| Workflow doesn't run | Check Actions enabled, verify secrets set | |
| 150 | +| Workflow doesn't run | Check Actions enabled and secrets are set | |
161 | 151 | | Can't find PRs | Verify `ORG_ACCESS_TOKEN` has correct permissions | |
162 | 152 | | Can't merge PRs | Ensure token has `contents: write` permission | |
163 | 153 | | Can't push fixes | Check token has write access to target repos | |
164 | | -| Gemini errors | Verify `GEMINI_API_KEY` is set and has quota | |
165 | | -| Rate limits | Reduce monitoring frequency in cron schedule | |
166 | | - |
167 | | -**Debug workflow**: |
168 | | -```bash |
169 | | -# View recent runs |
170 | | -gh run list --workflow=monitor-org-dependabot.yml --limit 5 |
171 | | - |
172 | | -# View specific run logs |
173 | | -gh run view RUN_ID --log |
174 | | -``` |
175 | | - |
176 | | -## Contributing |
177 | | - |
178 | | -Contributions welcome. Please test thoroughly before submitting PRs. |
179 | | - |
180 | | -## License |
| 154 | +| Gemini errors | Verify `GEMINI_API_KEY` is valid and has quota | |
| 155 | +| Rate limits | Reduce monitoring frequency in workflow cron schedule | |
181 | 156 |
|
182 | | -[Add appropriate license] |
| 157 | +See [SETUP.md](SETUP.md) for detailed troubleshooting. |
183 | 158 |
|
184 | 159 | --- |
185 | 160 |
|
|
0 commit comments