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

Commit

Permalink
ignore pr keyword (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
harjotgill authored Apr 14, 2023
1 parent c207012 commit 5850c25
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 5 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,23 @@ You can reply to a review comment made by this action and get a response based
on the diff context. Additionally, you can invite the bot to a conversation by
tagging it in the comment (`@openai`).

Examples:

> @openai Can you please review this block of code?
Example:

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

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

### Ignoring PRs

Sometimes it is useful to ignore a PR. For example, if you are using this action
to review documentation, you can ignore PRs that only change the documentation.
To ignore a PR, add the following keyword in the PR description:

```text
@openai: ignore
```

### Screenshots

![PR Summary](./docs/images/openai-pr-summary.png)
Expand Down
42 changes: 40 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified dist/tiktoken_bg.wasm
Binary file not shown.
15 changes: 15 additions & 0 deletions src/review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const octokit = new RetryOctokit({auth: `token ${token}`})
const context = github.context
const repo = context.repo

const ignore_keyword = '@openai: ignore'

export const codeReview = async (
lightBot: Bot,
heavyBot: Bot,
Expand Down Expand Up @@ -49,6 +51,19 @@ export const codeReview = async (
context.payload.pull_request.body
)
}

// if the description contains ignore_keyword, skip
if (inputs.description.includes(ignore_keyword)) {
core.info(`Skipped: description contains ignore_keyword`)
// post a comment to notify the user
await commenter.comment(
`Skipped: ignored by the user`,
SUMMARIZE_TAG,
'replace'
)
return
}

// as gpt-3.5-turbo isn't paying attention to system message, add to inputs for now
inputs.system_message = options.system_message

Expand Down

0 comments on commit 5850c25

Please sign in to comment.