feat(ci): update reviewer identity to Swadhin Biswas
Swadhin Biswas committed 7 months ago
e865633
1 parent cb36ce7
commit e865633
1 file changed
+25 -38
Showing 1 changed file+25-38
βΌ.github/workflows/auto-review.yml
+25-38
| @@ -23,18 +23,12 @@ jobs: | ||
23 | 23 | id: analysis |
24 | 24 | run: | |
25 | 25 | echo "π SARAS AI is analyzing the architecture..." |
26 | - | |
27 | - # Initialize error log | |
28 | 26 | echo "" > errors.log |
29 | 27 | |
30 | - echo "Checking Shared..." | |
31 | 28 | cd opengrammar/shared && bun install >> /dev/null 2>&1 |
32 | - | |
33 | - echo "Checking Backend..." | |
34 | 29 | cd ../backend && bun install >> /dev/null 2>&1 |
35 | 30 | bun x tsc --noEmit > ../../backend_errors.log 2>&1 || echo "BACKEND_FAILED" >> ../../errors.log |
36 | 31 | |
37 | - echo "Checking Extension..." | |
38 | 32 | cd ../extension && bun install >> /dev/null 2>&1 |
39 | 33 | bun x tsc --noEmit > ../../extension_errors.log 2>&1 || echo "EXTENSION_FAILED" >> ../../errors.log |
40 | 34 | |
| @@ -45,52 +39,46 @@ jobs: | ||
45 | 39 | echo "status=success" >> $GITHUB_OUTPUT |
46 | 40 | fi |
47 | 41 | |
48 | - - name: Process Review | |
42 | + - name: Process Review as Swadhin Biswas | |
49 | 43 | uses: actions/github-script@v7 |
50 | 44 | with: |
45 | + # Using your PAT makes the review come from "Swadhin Biswas" | |
51 | 46 | github-token: ${{ secrets.SARAS_TOKEN || secrets.GITHUB_TOKEN }} |
52 | 47 | script: | |
53 | 48 | const fs = require('fs'); |
54 | 49 | const status = '${{ steps.analysis.outputs.status }}'; |
55 | 50 | const isSuccess = status === 'success'; |
56 | 51 | |
57 | - const context = { | |
58 | - repo: { | |
59 | - owner: 'swadhinbiswas', | |
60 | - repo: 'opengrammar' | |
61 | - }, | |
62 | - issue: { | |
63 | - number: ${{ github.event.pull_request.number }} | |
64 | - } | |
65 | - }; | |
52 | + const owner = 'swadhinbiswas'; | |
53 | + const repo = 'opengrammar'; | |
54 | + const pull_number = context.payload.pull_request.number; | |
66 | 55 | |
67 | 56 | let report = ''; |
68 | 57 | if (isSuccess) { |
69 | - report = `### π€ SARAS AI Verdict: APPROVED β
| |
58 | + report = `### β
Code Review Approved | |
70 | 59 | |
71 | - I have verified the changes and they meet the high-signal standards for the SARAS Digital Intelligence system. | |
60 | + I have verified the changes for the SARAS Digital Intelligence system. | |
72 | 61 | |
73 | 62 | - **Architecture:** Optimized for Bun runtime. |
74 | 63 | - **Type Safety:** 100% verified via TSC. |
75 | - - **Structural Integrity:** Build-safe and production-ready. | |
64 | + - **Status:** Production-ready. | |
76 | 65 | |
77 | - The "Code-Free" review is complete. This PR is safe to merge.`; | |
66 | + **Reviewer Profile:** swadhinbiswas <[email protected]>`; | |
78 | 67 | |
79 | - // Formal Approval (Requires SARAS_TOKEN) | |
80 | 68 | try { |
81 | 69 | await github.rest.pulls.createReview({ |
82 | - owner: context.repo.owner, | |
83 | - repo: context.repo.repo, | |
84 | - pull_number: context.issue.number, | |
70 | + owner, | |
71 | + repo, | |
72 | + pull_number, | |
85 | 73 | event: 'APPROVE', |
86 | 74 | body: report |
87 | 75 | }); |
88 | 76 | } catch (e) { |
89 | - console.log('Formal approval failed (missing token), posting as comment instead.'); | |
77 | + // Fallback to comment if token isn't providing full review access | |
90 | 78 | await github.rest.issues.createComment({ |
91 | - owner: context.repo.owner, | |
92 | - repo: context.repo.repo, | |
93 | - issue_number: context.issue.number, | |
79 | + owner, | |
80 | + repo, | |
81 | + issue_number: pull_number, | |
94 | 82 | body: report |
95 | 83 | }); |
96 | 84 | } |
| @@ -98,25 +86,24 @@ jobs: | ||
98 | 86 | let backendErrors = fs.existsSync('backend_errors.log') ? fs.readFileSync('backend_errors.log', 'utf8') : ''; |
99 | 87 | let extensionErrors = fs.existsSync('extension_errors.log') ? fs.readFileSync('extension_errors.log', 'utf8') : ''; |
100 | 88 | |
101 | - // Simple text cleanup to prevent too large comments | |
102 | - backendErrors = backendErrors.split('\n').slice(0, 15).join('\n'); | |
103 | - extensionErrors = extensionErrors.split('\n').slice(0, 15).join('\n'); | |
89 | + backendErrors = backendErrors.split('\n').slice(0, 10).join('\n'); | |
90 | + extensionErrors = extensionErrors.split('\n').slice(0, 10).join('\n'); | |
104 | 91 | |
105 | - report = `### π€ SARAS AI Verdict: CHANGES REQUESTED β | |
92 | + report = `### β Changes Requested | |
106 | 93 | |
107 | - I have detected technical inconsistencies that block the evolution of the codebase. Please address the following issues: | |
94 | + Technical inconsistencies detected: | |
108 | 95 | |
109 | 96 | ${backendErrors ? '#### π₯οΈ Backend Errors:\n```\n' + backendErrors + '\n```' : ''} |
110 | 97 | ${extensionErrors ? '#### π§© Extension Errors:\n```\n' + extensionErrors + '\n```' : ''} |
111 | 98 | |
112 | - *Please fix these errors and push again to trigger a re-check.*`; | |
99 | + **Reviewer Profile:** swadhinbiswas <[email protected]>`; | |
113 | 100 | |
114 | 101 | await github.rest.issues.createComment({ |
115 | - owner: context.repo.owner, | |
116 | - repo: context.repo.repo, | |
117 | - issue_number: context.issue.number, | |
102 | + owner, | |
103 | + repo, | |
104 | + issue_number: pull_number, | |
118 | 105 | body: report |
119 | 106 | }); |
120 | 107 | |
121 | - process.exit(1); // Fail the job | |
108 | + process.exit(1); | |
122 | 109 | } |
123 | 110 | |