Skip to content
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

Foo4 #26

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Foo4 #26

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/gemini-pr-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Gemini PR Review

on:
pull_request:
types: [opened, synchronize] # Triggers on PR open and code updates

jobs:
gemini_review:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # seems necessary to diff with master instead of using HEAD

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install google-generativeai

- name: Get PR diff
id: get_diff
run: |
echo "DIFF<<EOF" >> $GITHUB_OUTPUT
echo $(git diff origin/${GITHUB_BASE_REF}...origin/${GITHUB_HEAD_REF} | base64) >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Gemini API Call
id: gemini_review_call
run: |
python <<EOF
import os, base64
import google.generativeai as genai

genai.configure(api_key=os.environ['GEMINI_API_KEY'])

model = genai.GenerativeModel('gemini-pro')
diff_encoded = "${{ steps.get_diff.outputs.DIFF }}".strip()
diff = base64.b64decode(diff_encoded).decode('utf-8')
prompt = f"Review this code diff for potential issues and provide feedback:\n\n {diff}"
response = model.generate_content(prompt)

print(f"REVIEW<<EOF")
print(response.text)
print(f"EOF")
EOF
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}

- name: Post Review Comment (Placeholder)
run: |
echo "This is a placeholder for posting a review comment."
echo "Gemini Review: ${{ steps.gemini_review_call.outputs.REVIEW }}"
4 changes: 2 additions & 2 deletions staging/src/k8s.io/api/core/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1953,7 +1953,7 @@ type ServiceAccountTokenProjection struct {
// its time to live or if the token is older than 24 hours.Defaults to 1 hour
// and must be at least 10 minutes.
// +optional
ExpirationSeconds *int64 `json:"expirationSeconds,omitempty" protobuf:"varint,2,opt,name=expirationSeconds"`
ExpirationSeconds *int32 `json:"expirationSeconds,omitempty" protobuf:"varint,2,opt,name=expirationSeconds"`
// path is the path relative to the mount point of the file to project the
// token into.
Path string `json:"path" protobuf:"bytes,3,opt,name=path"`
Expand Down Expand Up @@ -2559,7 +2559,7 @@ type ExecAction struct {
// SleepAction describes a "sleep" action.
type SleepAction struct {
// Seconds is the number of seconds to sleep.
Seconds int64 `json:"seconds" protobuf:"bytes,1,opt,name=seconds"`
Seconds int32 `json:"seconds" protobuf:"bytes,1,opt,name=seconds"`
}

// Probe describes a health check to be performed against a container to determine whether it is
Expand Down