Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

Commit 9ef3d05

Browse files
committed
Adding Support for Vertex Auth
1 parent e51c845 commit 9ef3d05

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

.github/workflows/gemini-pr-review.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,17 @@ jobs:
2828
pull-requests: write
2929
issues: write
3030
steps:
31-
- name: Generate GitHub App Token
32-
id: generate_token
33-
uses: actions/create-github-app-token@v1
34-
with:
35-
app-id: ${{ secrets.APP_ID }}
36-
private-key: ${{ secrets.PRIVATE_KEY }}
37-
3831
- name: Checkout PR code
3932
uses: actions/checkout@v4
4033
with:
41-
token: ${{ steps.generate_token.outputs.token }}
34+
token: ${{ secrets.GITHUB_TOKEN }}
4235
ref: ${{ github.event.pull_request.head.sha }}
4336
fetch-depth: 0
4437

4538
- name: Get PR details
4639
id: get_pr
4740
env:
48-
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4942
run: |
5043
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
5144
PR_NUMBER=${{ github.event.inputs.pr_number }}
@@ -78,7 +71,7 @@ jobs:
7871
- name: Run Gemini PR Review
7972
uses: ./
8073
env:
81-
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8275
PR_NUMBER: ${{ steps.get_pr.outputs.pr_number }}
8376
PR_DATA: ${{ steps.get_pr.outputs.pr_data }}
8477
CHANGED_FILES: ${{ steps.get_pr.outputs.changed_files }}
@@ -87,6 +80,8 @@ jobs:
8780
with:
8881
version: 0.1.8-rc.0
8982
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
83+
GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
84+
GOOGLE_CLOUD_LOCATION: ${{ secrets.GOOGLE_CLOUD_LOCATION }}
9085
OTLP_GCP_WIF_PROVIDER: ${{ secrets.OTLP_GCP_WIF_PROVIDER }}
9186
OTLP_GOOGLE_CLOUD_PROJECT: ${{ secrets.OTLP_GOOGLE_CLOUD_PROJECT }}
9287
settings_json: |

action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ inputs:
1010
GEMINI_API_KEY:
1111
description: 'Your Gemini API key.'
1212
required: true
13+
GOOGLE_CLOUD_PROJECT:
14+
description: 'The Google Cloud project.'
15+
required: false
16+
GOOGLE_CLOUD_LOCATION:
17+
description: 'The Google Cloud project.'
18+
required: false
1319
OTLP_GCP_WIF_PROVIDER:
1420
description: 'The workload identity provider for GCP authentication.'
1521
required: false
@@ -81,6 +87,9 @@ runs:
8187
shell: bash
8288
env:
8389
GEMINI_API_KEY: ${{ inputs.GEMINI_API_KEY }}
90+
GOOGLE_GENAI_USE_VERTEXAI: true
91+
GOOGLE_CLOUD_PROJECT: ${{ inputs.GOOGLE_CLOUD_PROJECT }}
92+
GOOGLE_CLOUD_LOCATION: ${{ inputs.GOOGLE_CLOUD_LOCATION }}
8493
PROMPT: ${{ inputs.prompt }}
8594

8695
branding:

scripts/setup_workload_identity.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,12 @@ gcloud projects add-iam-policy-binding "${GCP_PROJECT_ID}" \
250250
--member="${PRINCIPAL_SET}" \
251251
--condition=None
252252

253+
print_info "Granting vertex permissions..."
254+
gcloud projects add-iam-policy-binding "${GCP_PROJECT_ID}" \
255+
--role="roles/aiplatform.admin" \
256+
--member="${PRINCIPAL_SET}" \
257+
--condition=None
258+
253259
print_success "Standard permissions granted to Workload Identity Pool"
254260

255261
# Get the full provider name for output
@@ -284,5 +290,11 @@ echo ""
284290
echo "☁️ Secret Name: OTLP_GOOGLE_CLOUD_PROJECT"
285291
echo " Secret Value: ${GCP_PROJECT_ID}"
286292
echo ""
293+
echo "☁️ Secret Name: GOOGLE_CLOUD_LOCATION"
294+
echo " Secret Value: global"
295+
echo ""
296+
echo "☁️ Secret Name: GOOGLE_CLOUD_PROJECT"
297+
echo " Secret Value: ${GCP_PROJECT_ID}"
298+
echo ""
287299

288300
print_success "Setup completed successfully! 🚀"

0 commit comments

Comments
 (0)