github-actions[bot] commented on code in PR #40561: URL: https://github.com/apache/beam/pull/40561#discussion_r4264152430
########## .github/workflows/gemini_code_review.yml: ########## @@ -0,0 +1,212 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Gemini Enterprise Code Review + +on: + pull_request: + paths: + - '.github/workflows/gemini_code_review.yml' Review Comment: **🟡 Medium**: The `pull_request` trigger (lines 19-21) was re-added for testing on this PR. Before merging, remove the `pull_request` block so PRs from forks modifying this workflow do not fail on `pulls.createReview` due to read-only `GITHUB_TOKEN` permissions on `pull_request` events, and branch PRs do not trigger duplicate runs alongside `pull_request_target`. ########## .github/workflows/gemini_code_review.yml: ########## @@ -0,0 +1,212 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Gemini Enterprise Code Review + +on: + pull_request: + paths: + - '.github/workflows/gemini_code_review.yml' + pull_request_target: + types: [opened, reopened, ready_for_review] + workflow_dispatch: + inputs: + pr_number: + description: 'Pull Request number to review' + required: true + type: number + +permissions: read-all + +concurrency: + group: gemini-code-review-${{ github.event.pull_request.number || inputs.pr_number }} + cancel-in-progress: true + +jobs: + gemini-review: + name: Gemini Enterprise PR Review + if: github.repository == 'apache/beam' Review Comment: **🟡 Medium**: Restore the `!github.event.pull_request.draft` guard before merging so `opened` and `reopened` events on draft PRs do not trigger premature reviews before `ready_for_review`. ```suggestion if: github.repository == 'apache/beam' && !github.event.pull_request.draft ``` ########## .github/workflows/gemini_code_review.yml: ########## @@ -0,0 +1,212 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Gemini Enterprise Code Review + +on: + pull_request: + paths: + - '.github/workflows/gemini_code_review.yml' + pull_request_target: + types: [opened, reopened, ready_for_review] + workflow_dispatch: + inputs: + pr_number: + description: 'Pull Request number to review' + required: true + type: number + +permissions: read-all + +concurrency: + group: gemini-code-review-${{ github.event.pull_request.number || inputs.pr_number }} + cancel-in-progress: true + +jobs: + gemini-review: + name: Gemini Enterprise PR Review + if: github.repository == 'apache/beam' + runs-on: [self-hosted, ubuntu-24.04, main] + timeout-minutes: 15 + permissions: + contents: read + pull-requests: write + + steps: + - name: Setup Node.js + uses: actions/setup-node@v7 + with: + node-version: '20' + + - name: Run Gemini Enterprise Code Review Agent + id: gemini_review + shell: bash + env: + GEMINI_CLI_TRUST_WORKSPACE: 'true' + GEMINI_FORCE_FILE_STORAGE: 'true' + GOOGLE_GENAI_USE_VERTEXAI: 'true' + GOOGLE_CLOUD_PROJECT: ${{ secrets.GCP_PROJECT_ID || 'apache-beam-testing' }} + GOOGLE_CLOUD_LOCATION: 'global' + GEMINI_MODEL: ${{ vars.GEMINI_MODEL || 'gemini-4-argon' }} + PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }} + REPOSITORY: ${{ github.repository }} + run: | + set -euo pipefail + + PR_URL="https://github.com/${REPOSITORY}/pull/${PR_NUMBER}" + + mkdir -p .gemini + cat << 'EOF' > .gemini/settings.json + { + "model": { + "maxSessionTurns": 25 + }, + "experimental": { + "directWebFetch": true + }, + "tools": { + "core": [ + "web_fetch" + ] + } + } + EOF + + cat << 'EOF' > prompt_template.txt + You are an autonomous Apache Beam code review agent running on the Gemini Enterprise Agent Platform. + Review Pull Request: __PR_URL__ + + Respond with ONLY a single valid JSON object matching this exact schema (no markdown prose outside the JSON): + { + "summary": "## 📋 Review Summary\n\n2-3 sentence high-level assessment.\n\n## 🔍 General Feedback\n- Key architectural or cross-file observations.", + "comments": [ + { + "path": "relative/path/to/file.ext", + "line": 123, + "side": "RIGHT", + "severity": "🟠 High", + "body": "Clear explanation of why this is an issue and how to fix it.", + "suggestion": "optional exact replacement line(s) without backticks, or null" Review Comment: **🟡 Medium**: Because `inlineComments` (lines 172-177) only sends `line` and `side` without `start_line`, GitHub treats any `suggestion` fence as a replacement for that single line (`line`) only. If the agent outputs a replacement intended for a multi-line block, applying the suggestion in GitHub will leave the remaining original lines intact. Either instruct the model that `suggestion` may only be used when replacing the single target `line`, or add optional `start_line` support to the schema and review payload. ```suggestion "suggestion": "optional exact replacement for the single target line without backticks, or null" ``` -- 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]
