|
| 1 | +# Ideas for CRA-GitHub |
| 2 | + |
| 3 | +## Action-Only GitHub App for Custom Branding |
| 4 | + |
| 5 | +### Problem |
| 6 | +Current workflow uses `GITHUB_TOKEN` which always posts reviews as "github-actions[bot]" with generic avatar. No way to customize the identity. |
| 7 | + |
| 8 | +### Solution: Action-Only GitHub App |
| 9 | +Create a GitHub App that provides authentication tokens to workflows without requiring hosted webhooks. |
| 10 | + |
| 11 | +**Key Insight**: GitHub Apps can be used purely for identity/authentication in workflows without needing a 24/7 server. |
| 12 | + |
| 13 | +### Implementation |
| 14 | +1. **Create GitHub App** with custom name ("Amp Code Review") and logo |
| 15 | +2. **Configure permissions**: Pull requests (write), Checks (write), Contents (read) |
| 16 | +3. **No webhook URL needed** - app only provides tokens |
| 17 | +4. **Update workflow** to use `actions/create-github-app-token@v1` |
| 18 | +5. **Users install app + copy modified workflow** |
| 19 | + |
| 20 | +### Benefits |
| 21 | +- ✅ Custom branding ("Amp Code Review[bot]" with logo) |
| 22 | +- ✅ No hosting infrastructure required |
| 23 | +- ✅ Same compute model (runs on user's GitHub Actions) |
| 24 | +- ✅ Backwards compatible (can offer both options) |
| 25 | + |
| 26 | +### User Setup |
| 27 | +1. Install "Amp Code Review" GitHub App on repo |
| 28 | +2. Set secrets: `AMP_APP_ID`, `AMP_PRIVATE_KEY`, `AMP_API_KEY` |
| 29 | +3. Copy modified workflow that generates app token |
| 30 | +4. Reviews appear with custom branding |
| 31 | + |
| 32 | +### Modified Workflow |
| 33 | +```yaml |
| 34 | +steps: |
| 35 | + - uses: actions/create-github-app-token@v1 |
| 36 | + id: app-token |
| 37 | + with: |
| 38 | + app-id: ${{ secrets.AMP_APP_ID }} |
| 39 | + private-key: ${{ secrets.AMP_PRIVATE_KEY }} |
| 40 | + |
| 41 | + - name: Run Amp Code Review |
| 42 | + uses: docker://ghcr.io/sourcegraph/cra-github:latest |
| 43 | + env: |
| 44 | + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} # App token |
| 45 | + AMP_SERVER_URL: ${{ vars.AMP_SERVER_URL }} |
| 46 | + AMP_API_KEY: ${{ secrets.AMP_API_KEY }} |
| 47 | +``` |
| 48 | +
|
| 49 | +### Trade-offs |
| 50 | +- **Pro**: Custom branding without hosting costs |
| 51 | +- **Con**: Slightly more complex user setup (install app + workflow) |
| 52 | +- **Pro**: Can coexist with current simple approach |
0 commit comments