anc95 / ChatGPT-CodeReview

🐥 A code review bot powered by ChatGPT
https://github.com/apps/cr-gpt
ISC License
3.77k stars 361 forks source link

如何配置中文回答? #55

Open JeromeLin opened 1 year ago

JeromeLin commented 1 year ago

配置了 LANGUAGE: Chinese,依然是英文回答

https://github.com/ZhongAnTech/zarm/pull/1078

name: Code Review

permissions:
  contents: read
  pull-requests: write

on:
  pull_request:
    types: [opened, reopened]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: anc95/ChatGPT-CodeReview@v1.0.3
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
          LANGUAGE: Chinese
anc95 commented 1 year ago

@JeromeLin 你上面的 CI 里的 Review 其实是 app 评论的,而不是 github action 评论的 目前设置语言参数仅支持了 github action

我看了下你的仓库,建议的修改方式如下

  1. 卸载掉 app
  2. 我估计你没把 OPENAI_API_KEY 配置在 secrets 下,这里设置下 github action 就正常生效了
xxhgnxx commented 1 year ago

@anc95

https://github.com/xxhgnxx/my-vue-test/pull/3 我这里走的action 但也是英文 配置在项目中有

`name: Code Review

permissions: contents: read pull-requests: write

on: pull_request: types: [opened, reopened]

jobs: test: runs-on: ubuntu-latest steps:

有什么地方不太对吗?

anc95 commented 1 year ago

@xxhgnxx 版本指定为最新版试试

anc95/ChatGPT-CodeReview@v1.0.4
xxhgnxx commented 1 year ago

@anc95 可以了 感谢!

JeromeLin commented 1 year ago

@JeromeLin 你上面的 CI 里的 Review 其实是 app 评论的,而不是 github action 评论的 目前设置语言参数仅支持了 github action

我看了下你的仓库,建议的修改方式如下

  1. 卸载掉 app
  2. 我估计你没把 OPENAI_API_KEY 配置在 secrets 下,这里设置下 github action 就正常生效了

按照这样做还是不行。。。actions 的 comment 都没触发~ https://github.com/ZhongAnTech/zarm/pull/1079

anc95 commented 1 year ago

@JeromeLin https://github.com/ZhongAnTech/zarm/actions/runs/4542611651/jobs/8006243401

image

这个 key 还是空的,记得把 OPENAI_API_KEY 在 secrets 里设置下,如

image
JeromeLin commented 1 year ago

有设置

image
JeromeLin commented 1 year ago

会是组织下的仓库问题吗?我之前配置 surge 的时候也有碰到取不到 secrets 的情况

anc95 commented 1 year ago

@JeromeLin 问了下 ChatGPT,不知道是不是这个原因

默认情况下,由 fork 的仓库到主仓库 pull_request 触发的 GitHub Action 是没有权限访问 secrets 的。这是因为在 pull request 中可能存在恶意代码,因此 GitHub 采取了安全措施来限制 pull request 的访问权限,以防止未经授权的代码访问 secrets 。 要允许由 fork 的仓库到主仓库 pull_request 触发的 GitHub Action 访问 secrets,您需要在 workflow 文件中使用 repository_dispatch 或者 workflow_dispatch 触发方式。这两种触发方式都需要手动触发,不能自动由 pull request 触发,但是可以授权访问 secrets。 除此之外,如果您希望自动触发 GitHub Action 并访问 secrets,可以考虑使用 GitHub App 来代替 Personal Access Token,GitHub App 有更高的权限和更好的安全性。

https://github.com/pypa/gh-action-pypi-publish/discussions/49 这里也有个相关回答,但我在 Github Action 官网没找到类似限制的说明

JeromeLin commented 1 year ago

@anc95 感谢,我先试试

anc95 commented 1 year ago

@JeromeLin 目前看用 github app 会避免掉这个问题,我后续支持下 github app 的设置语言等参数,你们可以自己部署一个 app 自己使用,我是在一个 VPS 上部署的,不保证一直稳定

RealKai42 commented 11 months ago

@JeromeLin 目前看用 github app 会避免掉这个问题,我后续支持下 github app 的设置语言等参数,你们可以自己部署一个 app 自己使用,我是在一个 VPS 上部署的,不保证一直稳定

这个有进展嘛~ github app 一直是英语读起来比较困难~ 😊

adminlove520 commented 6 months ago

组织下会导致获取不到的情况的 建议还是放到主账号的仓库下