Skip to content

Commit

Permalink
Feat: Add PR status check before code review, enhance workflow, inclu…
Browse files Browse the repository at this point in the history
…de issue read for PR check, introduce logic to determine existence of PR via branch name, set PR number as output for action.
  • Loading branch information
utsmannn committed Jan 25, 2025
1 parent d01d4ba commit 4559cd7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,34 @@ jobs:
permissions:
contents: read
pull-requests: write
issues: read # Diperlukan untuk cek PR

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get PR status
id: check-pr
env:
BRANCH_NAME: ${{ github.ref_name }}
run: |
# Cek apakah ada PR yang terkait dengan branch
pr=$(gh pr list --head "$BRANCH_NAME" --json number --jq '.[0].number')
if [ -z "$pr" ]; then
echo "::set-output name=has_pr::false"
else
echo "::set-output name=has_pr::true"
echo "::set-output name=pr_number::$pr"
fi
- name: Run Customized Review
if: steps.check-pr.outputs.has_pr == 'true'
uses: .github/actions/code-reviewer
with:
gemini-api-key: ${{ secrets.GEMINI_API_KEY }}
github-token: ${{ secrets.GITHUB_TOKEN }}
model-name: 'gemini-1.5-pro-latest'
pr-number: ${{ steps.check-pr.outputs.pr_number }}
custom-instructions: |
**Language-Specific Checks:**
- PEP8 compliance
Expand Down

0 comments on commit 4559cd7

Please sign in to comment.