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

Commit a116595

Browse files
authored
github concurrency limits (#381)
<!-- This is an auto-generated comment: release notes by openai --> ### Summary by OpenAI **New Feature:** - Introduced a new input `github_concurrency_limit` with a default value of 6 to control the concurrency of retrieving file contents. - Increased the default values for `openai_concurrency_limit`. **Refactor:** - Replaced `console.log` calls with `warning` calls in the `onRateLimit` and `onSecondaryRateLimit` functions. **Documentation:** - Updated README.md with improved formatting, grammar, punctuation, installation instructions, and examples. > 🎉 With limits set and warnings in place, 🚀 > Our code now runs at a smoother pace. 🏃‍♂️💨 > Docs polished with a shiny face, ✨ > Making it easier for all to embrace. 🤗🌐 <!-- end of auto-generated comment: release notes by openai -->
1 parent ae22296 commit a116595

File tree

7 files changed

+118
-95
lines changed

7 files changed

+118
-95
lines changed

README.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
## AI based PR reviewer and summarizer
1+
# AI-based PR reviewer and summarizer
2+
23
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4+
35
<div>
46
<a href="https://github.com/coderabbitai/openai-pr-reviewer)/commits/main">
57
<img alt="GitHub" src="https://img.shields.io/github/last-commit/coderabbitai/openai-pr-reviewer/main?style=for-the-badge" height="20">
@@ -8,14 +10,15 @@
810

911
## Overview
1012

13+
CodeRabbit `ai-pr-reviewer` is an open-source project built on AI, designed to
14+
enhance developer productivity and efficiency by performing automated reviews of
15+
pull requests. Features:
1116

12-
CodeRabbit ai-pr-reviewer is an open-source project built on AI, designed to enhance developer productivity and efficiency by performing automated reviews of pull requests.
13-
Features:
14-
15-
- **PR Summarization**: It generates a summary and release notes of the changes in the pull request.
16-
- **Line-by-line code change suggestions**: Reviews the changes line
17-
by line and provides code change suggestions that can be directly committed
18-
from the GitHub UI.
17+
- **PR Summarization**: It generates a summary and release notes of the changes
18+
in the pull request.
19+
- **Line-by-line code change suggestions**: Reviews the changes line by line and
20+
provides code change suggestions that can be directly committed from the
21+
GitHub UI.
1922
- **Continuous, incremental reviews**: Reviews are performed on each commit
2023
within a pull request, rather than a one-time review on the entire pull
2124
request.
@@ -37,8 +40,10 @@ Features:
3740
`summarize_release_notes` prompts to focus on specific aspects of the review
3841
process or even change the review objective.
3942

40-
To use this tool, you need to add the provided YAML file to your repository and configure the required environment variables, such as GITHUB_TOKEN and OPENAI_API_KEY.
41-
For more information on usage, examples, contributing, and FAQs, you can refer to the sections below.
43+
To use this tool, you need to add the provided YAML file to your repository and
44+
configure the required environment variables, such as `GITHUB_TOKEN` and
45+
`OPENAI_API_KEY`. For more information on usage, examples, contributing, and
46+
FAQs, you can refer to the sections below.
4247

4348
- [Overview](#overview)
4449
- [Install instructions](#install-instructions)
@@ -48,9 +53,9 @@ For more information on usage, examples, contributing, and FAQs, you can refer t
4853
- [FAQs](#faqs)
4954

5055
## Install instructions
51-
ai-pr-reviewer runs as a GitHub Action.
52-
Add the below file to your repository at
53-
`.github/workflows/openai-pr-reviewer.yml`
56+
57+
`ai-pr-reviewer` runs as a GitHub Action. Add the below file to your repository
58+
at `.github/workflows/openai-pr-reviewer.yml`
5459

5560
```yaml
5661
name: Code Review
@@ -85,7 +90,6 @@ jobs:
8590
review_comment_lgtm: false
8691
```
8792
88-
8993
#### Environment variables
9094
9195
- `GITHUB_TOKEN`: This should already be available to the GitHub Action
@@ -146,7 +150,6 @@ system_message: |
146150
147151
</details>
148152
149-
150153
## Conversation with OpenAI
151154
152155
You can reply to a review comment made by this action and get a response based
@@ -170,8 +173,8 @@ To ignore a PR, add the following keyword in the PR description:
170173
@openai: ignore
171174
```
172175

173-
174176
## Examples
177+
175178
Some of the reviews done by ai-pr-reviewer
176179

177180
![PR Summary](./docs/images/openai-pr-summary.png)
@@ -185,7 +188,6 @@ Some of the reviews done by ai-pr-reviewer
185188
Any suggestions or pull requests for improving the prompts are highly
186189
appreciated.
187190

188-
189191
## Contribute
190192

191193
### Developing
@@ -205,7 +207,6 @@ Build the typescript and package it for distribution
205207
$ npm run build && npm run package
206208
```
207209

208-
209210
## FAQs
210211

211212
### Review pull requests from forks

action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ inputs:
139139
openai_concurrency_limit:
140140
required: false
141141
description: 'How many concurrent API calls to make to OpenAI servers?'
142-
default: '4'
142+
default: '6'
143+
github_concurrency_limit:
144+
required: false
145+
description: 'How many concurrent API calls to make to GitHub?'
146+
default: '6'
143147
system_message:
144148
required: false
145149
description: 'System message to be sent to OpenAI'

dist/index.js

Lines changed: 17 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ async function run(): Promise<void> {
2727
getInput('openai_retries'),
2828
getInput('openai_timeout_ms'),
2929
getInput('openai_concurrency_limit'),
30+
getInput('github_concurrency_limit'),
3031
getInput('openai_base_url')
3132
)
3233

src/octokit.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {getInput} from '@actions/core'
1+
import {getInput, warning} from '@actions/core'
22
import {Octokit} from '@octokit/action'
33
import {retry} from '@octokit/plugin-retry'
44
import {throttling} from '@octokit/plugin-throttling'
@@ -13,22 +13,22 @@ export const octokit = new RetryAndThrottlingOctokit({
1313
onRateLimit: (
1414
retryAfter: number,
1515
options: any,
16-
_o: typeof Octokit,
16+
_o: any,
1717
retryCount: number
1818
) => {
19-
console.log(
19+
warning(
2020
`Request quota exhausted for request ${options.method} ${options.url}
2121
Retry after: ${retryAfter} seconds
2222
Retry count: ${retryCount}
2323
`
2424
)
2525
if (retryCount <= 3) {
26-
console.log(`Retrying after ${retryAfter} seconds!`)
26+
warning(`Retrying after ${retryAfter} seconds!`)
2727
return true
2828
}
2929
},
3030
onSecondaryRateLimit: (retryAfter: number, options: any) => {
31-
console.log(
31+
warning(
3232
`SecondaryRateLimit detected for request ${options.method} ${options.url} ; retry after ${retryAfter} seconds`
3333
)
3434
}

src/options.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export class Options {
1717
openaiRetries: number
1818
openaiTimeoutMS: number
1919
openaiConcurrencyLimit: number
20+
githubConcurrencyLimit: number
2021
lightTokenLimits: TokenLimits
2122
heavyTokenLimits: TokenLimits
2223
apiBaseUrl: string
@@ -35,7 +36,8 @@ export class Options {
3536
openaiModelTemperature = '0.0',
3637
openaiRetries = '3',
3738
openaiTimeoutMS = '120000',
38-
openaiConcurrencyLimit = '4',
39+
openaiConcurrencyLimit = '6',
40+
githubConcurrencyLimit = '6',
3941
apiBaseUrl = 'https://api.openai.com/v1'
4042
) {
4143
this.debug = debug
@@ -52,6 +54,7 @@ export class Options {
5254
this.openaiRetries = parseInt(openaiRetries)
5355
this.openaiTimeoutMS = parseInt(openaiTimeoutMS)
5456
this.openaiConcurrencyLimit = parseInt(openaiConcurrencyLimit)
57+
this.githubConcurrencyLimit = parseInt(githubConcurrencyLimit)
5558
this.lightTokenLimits = new TokenLimits(openaiLightModel)
5659
this.heavyTokenLimits = new TokenLimits(openaiHeavyModel)
5760
this.apiBaseUrl = apiBaseUrl
@@ -73,6 +76,7 @@ export class Options {
7376
info(`openai_retries: ${this.openaiRetries}`)
7477
info(`openai_timeout_ms: ${this.openaiTimeoutMS}`)
7578
info(`openai_concurrency_limit: ${this.openaiConcurrencyLimit}`)
79+
info(`github_concurrency_limit: ${this.githubConcurrencyLimit}`)
7680
info(`summary_token_limits: ${this.lightTokenLimits.string()}`)
7781
info(`review_token_limits: ${this.heavyTokenLimits.string()}`)
7882
info(`api_base_url: ${this.apiBaseUrl}`)

0 commit comments

Comments
 (0)