diff --git a/.github/workflows/gemini-pr-review.yml b/.github/workflows/gemini-pr-review.yml new file mode 100644 index 0000000000000..73abde2515163 --- /dev/null +++ b/.github/workflows/gemini-pr-review.yml @@ -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<> $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 <