Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cr.yml #8

Open
wants to merge 1 commit into
base: yanghua-patch-5
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .github/workflows/cr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ on:

jobs:
test:
if: ${{ contains(github.event.*.labels.*.name, 'gpt review') }} # Optional; to run only when a label is attached
# Optional; to run only when a label is attached
# if: ${{ contains(github.event.*.labels.*.name, 'gpt review') }}
runs-on: ubuntu-latest
steps:
- uses: anc95/ChatGPT-CodeReview@main

Choose a reason for hiding this comment

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

这是一段通过 GitHub Action 运行 ChatGPT 代码审查的代码片段。下面是我对这段代码的简要评估:

  • 第 10 行和第 11 行之间的 if 语句被注释掉了,所以在运行时无论标签是否附加都会运行。
  • 此处没有检查代码库中的 github.event 值是否存在,如果不存在,则会导致错误.
  • 没有任何风险也没有明显的优化建议。

因此,如果您希望仅在附加了“gpt review”标签时才运行测试作业,则需要取消注释第 11 行并引入一个条件语句以判断github.event值是否存在,并根据需要做出相应的更改。

Expand Down