[#19] Swagger 설정 #14
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Gemini Code Review | |
| on: | |
| pull_request: | |
| types: [opened] | |
| workflow_dispatch: | |
| jobs: | |
| code-review: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20' | |
| - name: Install GoogleGenerativeAI | |
| run: npm install @google/generative-ai | |
| - name: Get git diff for PR | |
| run: | | |
| git fetch origin "${{ github.event.pull_request.base.ref }}" | |
| git fetch origin "${{ github.event.pull_request.head.ref }}" | |
| git diff "origin/${{ github.event.pull_request.base.ref }}"..."origin/${{ github.event.pull_request.head.ref }}" > diff.txt | |
| - name: Run Gemini Review | |
| env: | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| run: | | |
| node .github/scripts/gemini-review.js | |
| - name: Comment on Pull Request | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require("fs"); | |
| let body; | |
| try { | |
| body = fs.readFileSync("review_result.txt", "utf8"); | |
| } catch (e) { return; } | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: body | |
| }); |