Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Update openai-review.yml #481

Closed
wants to merge 1 commit into from
Closed
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
70 changes: 54 additions & 16 deletions .github/workflows/openai-review.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,77 @@
name: OpenAI Reviewer
name: ai-pr-reviewer

permissions:
contents: read
pull-requests: write
Comment on lines 3 to 5
Copy link
Contributor

Choose a reason for hiding this comment

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

Image description CodeRabbit

The permissions set for the GitHub Actions workflow are appropriate and follow the principle of least privilege. The contents: read permission allows the action to read repository content, and pull-requests: write allows it to write pull request data.


on:
pull_request_target:
types: [opened, synchronize, reopened]
pull_request:
types: [opened]
branches-ignore:
- master
- main
pull_request_review_comment:
types: [created]
issue_comment:
types: [created]
Comment on lines 7 to +16
Copy link
Contributor

Choose a reason for hiding this comment

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

Image description CodeRabbit

The event triggers have been updated to include pull_request with type opened, and issue_comment with type created. However, the pull_request_review_comment trigger is not correctly indented under the on: key. This could lead to unexpected behavior or errors when the workflow is triggered.

-13:    pull_request_review_comment:
+13:  pull_request_review_comment:


concurrency:
group:
${{ github.repository }}-${{ github.event.number || github.head_ref ||
github.sha }}-${{ github.workflow }}-${{ github.event_name ==
'pull_request_review_comment' && 'pr_comment' || 'pr' }}
group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}-${{ github.event_name == 'pull_request_review_comment' && 'pr_comment' || 'pr' }}
cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }}
Comment on lines 18 to 20
Copy link
Contributor

Choose a reason for hiding this comment

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

Image description CodeRabbit

The concurrency settings seem fine. They ensure that only one job runs per PR or comment, which can help prevent race conditions or redundant reviews.


jobs:
review:
runs-on: ubuntu-latest
if: (github.event_name == 'issue_comment' && contains(github.event.comment.body, '[run review]') && github.event.issue.pull_request) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '[run review]')) || (github.event_name == 'pull_request' && !contains(github.event.pull_request.title, 'release') && !contains(github.event.pull_request.title, 'Release'))
timeout-minutes: 15
Comment on lines 22 to +26
Copy link
Contributor

Choose a reason for hiding this comment

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

Image description CodeRabbit

The job setup looks good. It's set to run on ubuntu-latest and has a timeout of 15 minutes. The condition for running the job seems complex but valid, triggering on issue comments, pull request review comments, and pull requests that don't have 'release' in the title.

steps:
- uses: actions/checkout@v3
with:
repository: ${{github.event.pull_request.head.repo.full_name}}
ref: ${{github.event.pull_request.head.ref}}
submodules: false
- uses: ./
- uses: coderabbitai/openai-pr-reviewer@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
with:
debug: true
debug: false
review_simple_changes: false
review_comment_lgtm: false
openai_heavy_model: gpt-4
openai_light_model: gpt-4 # 好みで変更
openai_heavy_model: gpt-4 # 好みで変更
openai_timeout_ms: 900000 # 15分.
language: ja-JP
Comment on lines +28 to +39
Copy link
Contributor

Choose a reason for hiding this comment

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

Image description CodeRabbit

The step using coderabbitai/openai-pr-reviewer@latest is configured with environment variables for GITHUB_TOKEN and OPENAI_API_KEY. The with: parameters seem reasonable, although debug: false might limit troubleshooting if issues arise. The language model used is gpt-4, which should provide high-quality reviews. The language is set to Japanese (ja-JP), which matches the comments in the file.

path_filters: |
!dist/**
!db/**
!**/*.lock
Comment on lines 40 to 42
Copy link
Contributor

Choose a reason for hiding this comment

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

Image description CodeRabbit

The path filters exclude database files and lock files from the review. This seems reasonable as these files typically don't need code review.

system_message: |
あなたは @coderabbitai(別名 github-actions[bot])で、OpenAIによって訓練された言語モデルです。
あなたの目的は、非常に経験豊富なソフトウェアエンジニアとして機能し、コードの一部を徹底的にレビューし、
以下のようなキーエリアを改善するためのコードスニペットを提案することです:
- ロジック
- セキュリティ
- パフォーマンス
- データ競合
- 一貫性
- エラー処理
- 保守性
- モジュール性
- 複雑性
- 最適化
- ベストプラクティス: DRY, SOLID, KISS

些細なコードスタイルの問題や、コメント・ドキュメントの欠落についてはコメントしないでください。
重要な問題を特定し、解決して全体的なコード品質を向上させることを目指してくださいが、細かい問題は意図的に無視してください。
summarize: |
Comment on lines +44 to +61
Copy link
Contributor

Choose a reason for hiding this comment

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

Image description CodeRabbit

The system message is written in Japanese and provides a detailed explanation of the bot's purpose and capabilities. This is a good practice for clarity and user understanding.

次の内容でmarkdownフォーマットを使用して、最終的な回答を提供してください。

- *ウォークスルー*: 特定のファイルではなく、全体の変更に関する高レベルの要約を80語以内で。
- *変更点*: ファイルとその要約のテーブル。スペースを節約するために、同様の変更を持つファイルを1行にまとめることができます。

GitHubのプルリクエストにコメントとして追加されるこの要約には、追加のコメントを避けてください。
summarize_release_notes: |
このプルリクエストのために、その目的とユーザーストーリーに焦点を当てて、markdownフォーマットで簡潔なリリースノートを作成してください。
変更は次のように分類し箇条書きにすること:
"New Feature", "Bug fix", "Documentation", "Refactor", "Style",
"Test", "Chore", "Revert"
例えば:
```
- New Feature: UIに統合ページが追加されました
```
回答は50-100語以内にしてください。この回答はそのままリリースノートに使用されるので、追加のコメントは避けてください。
Comment on lines +62 to +77
Copy link
Contributor

Choose a reason for hiding this comment

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

Image description CodeRabbit

The summarize and summarize_release_notes options are set with detailed instructions in Japanese. These settings seem to be well thought out and should provide useful summaries and release notes.