Skip to content
Merged
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
27 changes: 18 additions & 9 deletions .github/workflows/PR-review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ jobs:
contains(github.event.comment.body, '/gemini-review')
steps:
- name: PR Info
env:
#Assign untrusted inputs to environment variables first
COMMENT_BODY: ${{ github.event.comment.body }}
ISSUE_NUM: ${{ github.event.issue.number }}
REPO: ${{ github.repository }}
#Use shell variables ("$VAR") instead of template tags
Comment on lines +21 to +25
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment placement here is confusing. Line 21's comment appears between the env: key and its values, making the structure unclear. Consider either: (1) indenting it to align with the environment variables (e.g., " #Assign..."), (2) placing it on the same line as env: (e.g., "env: #Assign..."), or (3) moving it above the env: line. Similarly, line 25's comment should be moved inside the run block or placed differently to improve readability.

Copilot uses AI. Check for mistakes.
run: |
echo "Comment: ${{ github.event.comment.body }}"
echo "Issue Number: ${{ github.event.issue.number }}"
echo "Repository: ${{ github.repository }}"
echo "Comment: $COMMENT_BODY"
echo "Issue Number: $ISSUE_NUM"
echo "Repository: $REPO"

- name: Checkout Repo
uses: actions/checkout@v3
Expand All @@ -30,17 +36,20 @@ jobs:

- name: Get PR Details
id: pr
run: |
PR_JSON=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }})
echo "head_sha=$(echo $PR_JSON | jq -r .head.sha)" >> $GITHUB_OUTPUT
echo "base_sha=$(echo $PR_JSON | jq -r .base.sha)" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
ISSUE_NUM: ${{ github.event.issue.number }}
#Use env vars for the API call to prevent injection
#Use quotes around variables to prevent word splitting
run: |
Comment on lines 40 to +45
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment placement here is confusing. Lines 43-44 appear at the wrong indentation level, between the environment variable definitions and the run: key. Consider indenting these comments to align with the environment variables (e.g., " #Use env vars...") to improve readability and make the YAML structure clearer.

Suggested change
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
ISSUE_NUM: ${{ github.event.issue.number }}
#Use env vars for the API call to prevent injection
#Use quotes around variables to prevent word splitting
run: |
# Use env vars for the API call to prevent injection
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
ISSUE_NUM: ${{ github.event.issue.number }}
run: |
# Use quotes around variables to prevent word splitting

Copilot uses AI. Check for mistakes.
PR_JSON=$(gh api "repos/$REPO/pulls/$ISSUE_NUM")
echo "head_sha=$(echo "$PR_JSON" | jq -r .head.sha)" >> $GITHUB_OUTPUT
echo "base_sha=$(echo "$PR_JSON" | jq -r .base.sha)" >> $GITHUB_OUTPUT

- uses: truongnh1992/gemini-ai-code-reviewer@main
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
GEMINI_MODEL: gemini-2.5-flash
EXCLUDE: "*.md,*.txt,package-lock.json"

EXCLUDE: "*.md,*.txt,package-lock.json"
Loading