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

Commit 5850c25

Browse files
authored
ignore pr keyword (#179)
1 parent c207012 commit 5850c25

File tree

4 files changed

+66
-5
lines changed

4 files changed

+66
-5
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,23 @@ You can reply to a review comment made by this action and get a response based
6666
on the diff context. Additionally, you can invite the bot to a conversation by
6767
tagging it in the comment (`@openai`).
6868

69-
Examples:
70-
71-
> @openai Can you please review this block of code?
69+
Example:
7270

7371
> @openai Please generate a test plan for this file.
7472

7573
Note: A review comment is a comment made on a diff or a file in the pull
7674
request.
7775

76+
### Ignoring PRs
77+
78+
Sometimes it is useful to ignore a PR. For example, if you are using this action
79+
to review documentation, you can ignore PRs that only change the documentation.
80+
To ignore a PR, add the following keyword in the PR description:
81+
82+
```text
83+
@openai: ignore
84+
```
85+
7886
### Screenshots
7987

8088
![PR Summary](./docs/images/openai-pr-summary.png)

dist/index.js

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

dist/tiktoken_bg.wasm

185 Bytes
Binary file not shown.

src/review.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const octokit = new RetryOctokit({auth: `token ${token}`})
1818
const context = github.context
1919
const repo = context.repo
2020

21+
const ignore_keyword = '@openai: ignore'
22+
2123
export const codeReview = async (
2224
lightBot: Bot,
2325
heavyBot: Bot,
@@ -49,6 +51,19 @@ export const codeReview = async (
4951
context.payload.pull_request.body
5052
)
5153
}
54+
55+
// if the description contains ignore_keyword, skip
56+
if (inputs.description.includes(ignore_keyword)) {
57+
core.info(`Skipped: description contains ignore_keyword`)
58+
// post a comment to notify the user
59+
await commenter.comment(
60+
`Skipped: ignored by the user`,
61+
SUMMARIZE_TAG,
62+
'replace'
63+
)
64+
return
65+
}
66+
5267
// as gpt-3.5-turbo isn't paying attention to system message, add to inputs for now
5368
inputs.system_message = options.system_message
5469

0 commit comments

Comments
 (0)