derrickaw commented on code in PR #40589:
URL: https://github.com/apache/beam/pull/40589#discussion_r4275468792


##########
.github/workflows/gemini_code_review.yml:
##########
@@ -50,13 +50,42 @@ jobs:
       pull-requests: write
 
     steps:
+      - name: Check for existing Gemini review from draft
+        id: check_draft_review
+        if: github.event_name == 'pull_request_target' && github.event.action 
== 'ready_for_review'
+        uses: actions/github-script@v9
+        env:
+          PR_NUMBER: ${{ github.event.pull_request.number }}
+        with:
+          script: |
+            const prNumber = Number(process.env.PR_NUMBER);
+            const reviews = await 
github.paginate(github.rest.pulls.listReviews, {
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              pull_number: prNumber,
+              per_page: 100,
+            });
+            const reviewedInDraft = reviews.some(
+              r =>
+                r.user &&
+                r.user.login === 'github-actions[bot]' &&
+                typeof r.body === 'string' &&
+                r.body.includes('/gemini review')
+            );
+            if (reviewedInDraft) {
+              core.info(`PR #${prNumber} was already reviewed by Gemini while 
in draft; skipping automatic review on ready_for_review.`);
+            }
+            core.setOutput('reviewed_in_draft', reviewedInDraft ? 'true' : 
'false');

Review Comment:
   It shouldn't since this is gated on line 55. But I will verify again 
afterwards and make adjustments as needed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to