File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ jobs:
1212 - name : Checkout code
1313 uses : actions/checkout@v3
1414 with :
15- fetch-depth : 0
15+ fetch-depth : 0 # seems necessary to diff with master instead of using HEAD
1616
1717 - name : Set up Python
1818 uses : actions/setup-python@v4
1919 with :
20- python-version : ' 3.9' # Or your preferred version
20+ python-version : ' 3.9'
2121
2222 - name : Install dependencies
2323 run : |
@@ -28,20 +28,22 @@ jobs:
2828 id : get_diff
2929 run : |
3030 echo "DIFF<<EOF" >> $GITHUB_OUTPUT
31- git diff origin/${GITHUB_BASE_REF}...origin/${GITHUB_HEAD_REF} >> $GITHUB_OUTPUT
31+ echo $( git diff origin/${GITHUB_BASE_REF}...origin/${GITHUB_HEAD_REF} | base64) >> $GITHUB_OUTPUT
3232 echo "EOF" >> $GITHUB_OUTPUT
3333
3434 - name : Gemini API Call
3535 id : gemini_review_call
3636 run : |
3737 python <<EOF
38- import os
38+ import os, base64
3939 import google.generativeai as genai
4040
4141 genai.configure(api_key=os.environ['GEMINI_API_KEY'])
4242
4343 model = genai.GenerativeModel('gemini-pro')
44- prompt = f"Review this code diff for potential issues and provide feedback:\n\n ${{ steps.get_diff.outputs.DIFF }}"
44+ diff_encoded = "${{ steps.get_diff.outputs.DIFF }}".strip()
45+ diff = base64.b64decode(diff_encoded).decode('utf-8')
46+ prompt = f"Review this code diff for potential issues and provide feedback:\n\n {diff}"
4547 response = model.generate_content(prompt)
4648
4749 print(f"REVIEW<<EOF")
You can’t perform that action at this time.
0 commit comments