anc95 / chatgpt-codereview Goto Github PK
View Code? Open in Web Editor NEW🐥 A code review bot powered by ChatGPT
Home Page: https://github.com/apps/cr-gpt
License: ISC License
🐥 A code review bot powered by ChatGPT
Home Page: https://github.com/apps/cr-gpt
License: ISC License
hello, I have some question when i use this action to review my code in pr, the workflow is success and no any logs, but not any review message appear in my pr, this is why?
link: https://github.com/matrixorigin/matrixone/actions/runs/5089548569/jobs/9147314734
help(。ì _ í。)@anc95
Enabled this bot in a documentation website with markdowns files, but it seems that the bot does more code review (which isn't needed for our use case) than writing review, such as spelling and grammar.
Is our use case not appropriate for this bot or is there any config we haven't explored?
TIA!
We should be able to change the prompt to adjust the response to our needs.
你好,我是一位小开发人员,我看到你这个机器人比较感兴趣,因此我计划做两件事:
1、先体验使用看看这个机器人是如何运行的,因此我按照ReadMe中的描述,选择了 Self-hosting 模式进行安装在一台 linux 服务器上,但是安装过程报错了,在执行第二步的时候 回显是 undefined ,我不知道是否是正常的,在执行第三步的时候就直接报错了,能帮看看是啥原因吗?
2、第二件事就是,我使用的是Gerrit 代码托管平台,我想把你这个机器人改造成我的一个小服务,然后在我往 gerrit 上提交代码的时候,调用改造后的机器人接口,也能实现自动添加 reviewer 的功能,那么我需要具体怎么做,能详细指导一下吗?
There are many people using this workflow in Japan, and I would like to create a Japanese version of the README since it does not exist.
make README (Japanese ver)
Although the code base has different logging system to log the process of it as an action, logs are not properly showing upon it being ran as a github action, as seen in https://github.com/mattverse/osmosis/actions/runs/4643912516/jobs/8218840376?pr=12
What are some of the ways I can see the logs that were printed throughout the run for better debugging?
Hey,
I love it! Awesome job. I'm trying to run it only when I set a particular label for the PR (to save tokens for small PRs).
name: Code Review
permissions:
contents: read
pull-requests: write
on:
pull_request:
types: [opened, reopened, labeled]
jobs:
test:
if: github.event.label.name == 'GPT-CR'
runs-on: ubuntu-latest
steps:
- uses: anc95/ChatGPT-CodeReview@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# Optional
LANGUAGE: English
I also get the action triggered, but for some reason, no feedback is posted on the PR.
Here is the action result:
Any idea why no feedback is provided?
想问下会有安全问题吗,chatgpt联网,代码review的时候会有些代码暴露,假如我要把这个引入公司,领导问我这个安全问题,我该怎么回答呢
看起来该工具是将每个文件单独review,并且直接跳过长度大于4000的文件,是否有更好的方式,比如对总长不超过4000的文件合并review,对超长文件切分review?
openai 本身有频率限制
免费试用用户现在除了 3 次请求 / 分钟外,还有个 token 数量限制,每分钟最多发送 4 万个 tokens
程序有避让措施吗?
I would like to make the Action to review even in draft. If a pull request gets ready to review, humans get in the loop of the review. Developers have to pass code refined with GPT to humans beforehand.
https://github.com/anc95/ChatGPT-CodeReview/blob/main/src/bot.ts#L58
We may pass an input or an environment variable to the Action whether or not we run the Action in draft.
Aside from that, it would be good to clearly define inputs and outputs of the Action in action.yml
so that users of the Action can easily understand them.
Is there any reason why the OPEN_API_KEY is intended to be a variable rather than a secret? I think the latter would be more secure and achieves the same thing.
refer to Certseeds/openpgpage#4
use actions to trigger code-review
name: Code Review
permissions:
contents: read
pull-requests: write
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
test:
if: github.repository == 'Certseeds/openpgpage'
runs-on: ubuntu-latest
steps:
- uses: anc95/ChatGPT-CodeReview@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.CHATGPT_SESSION_TOKEN }}
1st commit trigger a review, get a meaningful response.
2nd force-push trigger a review, find a meaingful response too.
but the 3rd and 4th push can trigger actions but do not find response, is that corect?
ps:
the 3rd action https://github.com/Certseeds/openpgpage/actions/runs/4315833869
the 4th action https://github.com/Certseeds/openpgpage/actions/runs/4315849686
Got this error from multiple PRs:
Seems you are using me but didn't get OPENAI_API_KEY seted in Variables/Secrets for this repo. you could follow readme for more information
(transmission-remote-gui/transgui#1427)
The secret was set as mentioned in the readme, tried both Repository & Organization level:
Not sure what's wrong? (I installed from https://github.com/apps/cr-gpt)
Hi there. Thank you for making such a great app, but I would like to get a code review in Korean.
When I looked at the code in the repo, it seems that I can register the LANGUAGE configuration file and process it in the desired language.
But when I test it several times, the code review message is still written in English only.
It would be helpful if the README.md documentation also described how to set the language.
Thanks.
在同一个PR的第二次提交中,批量提交了多个commit,但bot没有产生任何回复,只有最后一个commit上面显示了一个√。
然后再次提交一个commit(修改的文件在之前的commit已经出现过),bot对该文件之前提交的内容进行了review,它原本应该出现在上一轮的提交中才对。
I have succeeded in integrating this via github actions with the basic, recommended commands.
I wanted to take a step further, and make this be triggered only when I have added a specific label to the PR itself.
This is the sample integration I have been working on.
Notice that this is almost identical to the original example provided in this repository, the only difference is that it has an if statement for the job to run.
Also notice how the action itself has been properly started, as we can know from run https://github.com/mattverse/osmosis/actions/runs/4604642813/jobs/8135769907?pr=12.
Would there be specific reason why adding on new logic on top of this gh action might be causing this flakiness?
Hello!
I'm using your app really really well.
Let me give you a suggestion.
The code review conducted by the app includes deleted files, which is not necessary. In the code file src/bot.ts, the changedFiles
variable obtained from the data.data
object includes files with changes, including deleted files. The file.status
property can be one of added
, modified
, removed
, renamed
, or copied
. Therefore, it is suggested to exclude the files with the removed
and renamed
status from the changeFiles
. It may also be helpful to add an environment variable to control this behavior.
// src/bot.ts
let { files: changedFiles, commits } = data.data; // 68 line
Exclude the files with the removed and renamed status from the changeFiles function, and consider adding an environment variable to control this behavior.
name: Code Review
permissions:
contents: read
pull-requests: write
on:
pull_request:
types: [opened, reopened]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: anc95/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
LANGUAGE: Chinese
Bellow is the code patch, please help me do a brief code review, if any bug risk and improvement suggestion are welcome
class ElasticQueryServiceImpl(
override fun addSplitListQuery(value: String?, fieldName: String): BoolQueryBuilder? {
if (value.isNullOrEmpty()) return null
val codes = listOf(value.split(",".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray())
val codes = value.split(",".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
val boolQueryBuilder = QueryBuilders.boolQuery()
codes.forEach { boolQueryBuilder.should(QueryBuilders.matchQuery(fieldName, it).operator(Operator.AND)) }
return boolQueryBuilder
code-review cost: 4.652s
gpt cost: 5.9
!
Code Review:
The code looks generally good. The changes made are valid and the logic is sound.
However, there is one small bug risk I see. The listOf() function creates an immutable list, but the code expects to modify it, so it should be changed to a mutable list. Also, the value.split() returns an array of strings, so the codes variable should be declared as an array instead of a list.
Overall, the code looks good and should work as expected.
The app response:
Seems you are using me but didn't get OPENAI_API_KEY seted in Variables/Secrets for this repo. you could follow readme for more information.
For some reason, there was an issue with the review
and action didn't cancel until the 6-hour timeout had elapsed
@@ -6,6 +6,7 @@
import lombok.Getter;
import java.math.BigDecimal;
import java.math.RoundingMode;
@Getter
@Builder(access = AccessLevel.PRIVATE)
@@ -21,6 +22,8 @@ public class SubscriptionPlanDto {
public static SubscriptionPlanDto NONE() {
// TODO: 구독 없는 경우 어떻게 처리? (플로우)
return SubscriptionPlanDto.builder()
.planCode("")
.price(BigDecimal.ZERO)
.name("이용중인 서비스 없음")
.isActive(false)
.build();
@@ -34,7 +37,7 @@ public static SubscriptionPlanDto of(SubscriptionPlan plan) {
.description(plan.getDescription())
.planCode(plan.getPlanCode())
.price(plan.getPrice())
.priceIncludeVat(plan.getPrice().multiply(BigDecimal.valueOf(1.1)))
.priceIncludeVat(plan.getPrice().multiply(BigDecimal.valueOf(1.1)).setScale(0, RoundingMode.FLOOR)) // 1원단위 절삭
.isActive(plan.getIsActive())
.build();
}
This code that tried, just simple
Seems you are using me but didn't get OPENAI_API_KEY seted in Variables/Secrets for this repo. you could follow readme for more information
Could you let me know, why my github demo project still get the message?
The 429 too many request error appears in the open api, is it a bug? Or should I use the paid version?
this is error code
Error: OpenAI error 429: {
"error": {
"message": "You exceeded your current quota, please check your plan and billing details.",
"type": "insufficient_quota",
"param": null,
"code": null
}
}
at /home/runner/work/_actions/anc95/ChatGPT-CodeReview/main/action/index.cjs:153249:29
at processTicksAndRejections (node:internal/process/task_queues:96:5)
{
this is my yml code
name: Code Review
permissions:
contents: read
pull-requests: write
on:
pull_request:
types: [opened, synchronize]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: anc95/ChatGPT-CodeReview@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
LANGUAGE: Korean
MODEL: gpt-3.5-turbo
top_p: 1
temperature: 1
As per Github Actions version, it would be convenient if you can specify the label name to be reviewed in GitHub App version.
Here's my implementation suggestion.
add label name to .env
add label name such as TARGET_LABEL
to .env.
https://github.com/anc95/ChatGPT-CodeReview/blob/main/.env.example
add a label check in bot.ts
If TARGET_LABEL
is specified in .env, check if the label is attached.
const target_label = process.env.TARGET_LABEL
if (target_label && pull_request.labels.every(label => label.name !== target_label)) {
return "no target label attached"
}
Line 61 in 8833ed9
I also tried to make a PR, but npm test
doesn't work for my environment. (Windows / WSL2)
Hi, all.
We are using bitbucket in our company, so I would like to ask if you will consider supporting bitbucket.
Thanks.
Looks like package-lock.json
is missing, or should we switch to yarn in Dockerfile, as there is yarn.lock
file?
~/ChatGPT-CodeReview $ docker build -t before .
Sending build context to Docker daemon 17.38MB
Step 1/8 : FROM node:18-slim
18-slim: Pulling from library/node
9e3ea8720c6d: Pull complete
22cee24855b2: Pull complete
1f1858138a90: Pull complete
6e736ef1cbb5: Pull complete
c4ef7605ff4f: Pull complete
Digest: sha256:2ff9841de879f1a2d2d8ef83183c2d93435c451a36d6cfb37b3331d1386c00f8
Status: Downloaded newer image for node:18-slim
---> 249e97c8a29e
Step 2/8 : WORKDIR /usr/src/app
---> Running in eb421e4594e0
Removing intermediate container eb421e4594e0
---> d958cab7c813
Step 3/8 : COPY package.json package-lock.json ./
COPY failed: file not found in build context or excluded by .dockerignore: stat package-lock.json: file does not exist
有时候太啰嗦了,比如Hi-Windom/Sillot#395
Do you have any plans to add configuration options that would allow the use of custom LLMs in future versions?
I recently published a package llm-client that can be very helpful in enabling the support to run other LLM models, including OpenAI, Google, AI21, HuggingfaceHub, Aleph Alpha, Anthropic, Local models with transformers.
Hey there! Great project, it seems to work as intended and the CRs are very useful.
For our use case, and I imagine for many others as well, it would be beneficial to be able to customize the prompt.
The easiest solution would be to expose it as an env var, e.g.: OPEN_API_PROMPT
or similar.
Thoughts? Let me know if you want me to make a PR.
Hi, it might be useful to add summary of the change to the PR description in addition to the detailed review for the files in the diff?
I have a problem with OPENAI_API_KEY not being recognized.
In the first attempt, I set the OPENAI_API_KEY variable in the Variables tab. The GitHub Action runs, but OPENAI_API_KEY is empty, and the error message says it cannot be found.
In the second attempt, I set up the YAML file like this and pushed it, but OPENAI_API_KEY is still empty.
Despite setting up the OPENAI_API_KEY in Actions secrets and variables, you are still encountering an issue where the OPENAI_API_KEY value is not being recognized.
name: Code Review
permissions:
contents: read
pull-requests: write
on:
pull_request:
types: [opened, synchronize]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: anc95/ChatGPT-CodeReview@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
Please tell me how to solve the problem.🥲
ChatGPT Plus has more free token every month.
Can support that?
I tried to switch from GitHub Apps version to GitHub Actions version, but it seems default GITHUB_TOKEN won't have enough permission to comment, not sure if using a PAT would be a good idea, anyone got the same issue and how do you deal with it? Thanks!
https://github.com/transmission-remote-gui/transgui/actions/runs/5038925037/jobs/9036731668?pr=1302
env:
GITHUB_TOKEN: ***
OPENAI_API_KEY:
MODEL: gpt-4
top_p: 1
temperature: 0.2
Error: Resource not accessible by integration
{
name: 'event',
id: '5038925037',
err: {
type: 'RequestError',
message: 'Resource not accessible by integration',
stack: 'HttpError: Resource not accessible by integration\n' +
' at /home/runner/work/_actions/anc95/ChatGPT-CodeReview/main/action/index.cjs:4070:21\n' +
' at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' +
' at async Job.doExecute (/home/runner/work/_actions/anc95/ChatGPT-CodeReview/main/action/index.cjs:34389:18)',
name: 'HttpError',
status: 403,
response: {
url: 'https://api.github.com/repos/transmission-remote-gui/transgui/issues/1302/comments',
I would like to update the prompt to use the contribution guidelines and then review the PR based on that. This should be configurable and should be read by the bot once.
contribution_guideline: ./docs/Contributing.md
配置了 LANGUAGE: Chinese,依然是英文回答
name: Code Review
permissions:
contents: read
pull-requests: write
on:
pull_request:
types: [opened, reopened]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: anc95/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
LANGUAGE: Chinese
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.