-
Notifications
You must be signed in to change notification settings - Fork 2
feat(ci): ClawReview 🦀 — our own advisory PR bot (policy + duplicates + review) #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
KrasimirKralev
merged 5 commits into
ID-Robots:main
from
KrasimirKralev:feat/clawreview-bot
Jul 5, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4980b5b
feat(ci): ClawReview — our own advisory PR bot (policy + duplicates +…
KrasimirKralev 680b149
feat(ci): ClawReview review fixes — empirically tuned policy, hardene…
KrasimirKralev c73f706
feat(ci): give ClawReview its crab voice 🦀
KrasimirKralev 1573b62
feat(ci): optional ClawReview GitHub App identity (clawreview[bot] + …
KrasimirKralev 43e9b23
feat(ci): OAuth subscription transport + CodeRabbit fixes
KrasimirKralev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| name: ClawReview | ||
|
|
||
| # ClawBox's own PR bot 🦀 — structured advisory review + repo-policy checks + | ||
| # duplicate detection on every PR. Complements CodeRabbit. See | ||
| # scripts/pr-review.mjs. | ||
| # | ||
| # SECURITY: pull_request_target grants secret access on fork PRs, so this | ||
| # workflow must NEVER check out or execute PR code. The checkout below is the | ||
| # BASE repo (our trusted main); the PR is reviewed as data via the API diff. | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| types: [opened, reopened, synchronize, ready_for_review] | ||
|
|
||
| # Empty default grant — only the job's explicit scopes apply. | ||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: clawreview-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| review: | ||
| runs-on: ubuntu-latest | ||
| # Job-scoped so future jobs don't inherit write access. | ||
| permissions: | ||
| pull-requests: write | ||
| issues: write | ||
| contents: read | ||
| # Bot PRs (dependabot etc.) get CI + human review; ClawReview skips them. | ||
| # Drafts are skipped too (reviewed at ready_for_review) — no API spend | ||
| # while the author is still iterating. | ||
| if: ${{ !endsWith(github.event.pull_request.user.login, '[bot]') && !github.event.pull_request.draft }} | ||
| steps: | ||
| - name: Checkout (base repo only — never the PR head) | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | ||
| with: | ||
| node-version: 22 | ||
|
|
||
| - name: Install Claude backend | ||
| # Two transports, one wins at runtime (script picks by env): | ||
| # - CLAUDE_CODE_OAUTH_TOKEN set -> Claude Code CLI (subscription/OAuth, | ||
| # the team's preferred path; same runtime as claude-code-action) | ||
| # - else ANTHROPIC_API_KEY -> the SDK | ||
| # Install whichever backend the available secret needs; both pinned. | ||
| # Keep versions in sync with issue-triage.yml. | ||
| env: | ||
| HAS_OAUTH: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
| run: | | ||
| if [ -n "$HAS_OAUTH" ]; then | ||
| npm install -g @anthropic-ai/claude-code@2.1.201 | ||
| else | ||
| npm install --prefix scripts --no-save @anthropic-ai/sdk@0.106.0 | ||
| fi | ||
|
|
||
| - name: Mint ClawReview app token | ||
| # Optional custom identity: when the ClawReview GitHub App is | ||
| # configured (CLAWREVIEW_APP_ID + CLAWREVIEW_APP_PRIVATE_KEY secrets), | ||
| # comments/labels post as clawreview[bot] with the crab avatar. | ||
| # Without the secrets this step skips and we fall back to | ||
| # github-actions[bot] — the bot works either way. | ||
| id: app-token | ||
| if: env.HAS_APP != '' | ||
| env: | ||
| HAS_APP: ${{ secrets.CLAWREVIEW_APP_ID }} | ||
| uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2 | ||
| with: | ||
| app-id: ${{ secrets.CLAWREVIEW_APP_ID }} | ||
| private-key: ${{ secrets.CLAWREVIEW_APP_PRIVATE_KEY }} | ||
|
|
||
| - name: Review with Claude | ||
| env: | ||
| CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }} | ||
| run: node scripts/pr-review.mjs | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.