Skip to content

Commit

Permalink
Add !ai condition to run AI
Browse files Browse the repository at this point in the history
  • Loading branch information
Corantin committed Sep 18, 2024
1 parent 5841148 commit bbb3262
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/ai-code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: "Check for !ai keyword in commit message"
id: check_commit_message
run: |
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
echo "Commit message: $COMMIT_MESSAGE"
if [[ "$COMMIT_MESSAGE" == *"!ai"* ]]; then
echo "run_ai=true" >> $GITHUB_ENV
else
echo "run_ai=false" >> $GITHUB_ENV
fi
- name: "Check if relevant files are modified"
id: check_changes
shell: bash
Expand All @@ -27,7 +38,7 @@ jobs:
fi
- name: "Get diff of the pull request"
if: env.files_changed == 'true'
if: env.files_changed == 'true' && env.run_ai == 'true'
id: get_diff
shell: bash
env:
Expand All @@ -44,7 +55,7 @@ jobs:
- uses: rubensflinco/[email protected]
name: "Code Review by Gemini AI"
if: env.files_changed == 'true'
if: env.files_changed == 'true' && env.run_ai == 'true'
continue-on-error: true
id: review
with:
Expand Down

0 comments on commit bbb3262

Please sign in to comment.