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

Update openai-review.yml #481

wants to merge 1 commit into from

Conversation

mobile4790
Copy link

@mobile4790 mobile4790 commented Oct 10, 2023

Summary by CodeRabbit

- New Feature: Added support for `pull_request` and `issue_comment` event triggers to enhance the workflow's responsiveness.
- New Feature: Introduced a feature to automatically generate summarized release notes, improving the clarity of changes made in each release.
- Refactor: Updated job steps and environment variables for better workflow management.
- Chore: Added system messages for the reviewer to provide more context during code reviews.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 10, 2023

Image description CodeRabbit

Walkthrough

The changeset introduces significant updates to the GitHub Actions workflow, enhancing its functionality and versatility. It adds new event triggers, modifies job steps, and introduces a feature to summarize release notes. The workflow is now more responsive and informative, providing system messages for reviewers and supporting comments in Japanese.

Changes

File Summary
.github/workflows/openai-review.yml The workflow name has been updated, with new event triggers (pull_request, issue_comment) added. Job steps have been modified, including updates to environment variables and path filters. A new feature to summarize release notes has been introduced. Comments in Japanese have been added for configuration options.

🐇💻

In the land of code where the shadows lie,

We update, we change, under the cloud's sky.

New triggers awake, steps dance anew,

With each line we make, our purpose true.

Release notes sing, in summaries bright,

To the pull request's ring, we bring light.

So here's to the code, in data's vast sea,

On the endless road, forever free. 🎉🥳


Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.

@mobile4790 mobile4790 closed this Oct 10, 2023
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 44244a9 and 8c188b6 commits.
Files selected (1)
  • .github/workflows/openai-review.yml (1)
Review comments generated (8)
  • Review: 8
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Comment on lines 3 to 5
permissions:
contents: read
pull-requests: write
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.

Comment on lines 7 to +16
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]
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:

Comment on lines 18 to 20
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' }}
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.

Comment on lines 22 to +26
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
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.

Comment on lines +28 to +39
- 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
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.

Comment on lines 40 to 42
path_filters: |
!dist/**
!db/**
!**/*.lock
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.

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

些細なコードスタイルの問題や、コメント・ドキュメントの欠落についてはコメントしないでください。
重要な問題を特定し、解決して全体的なコード品質を向上させることを目指してくださいが、細かい問題は意図的に無視してください。
summarize: |
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.

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

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

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant