1
0
mirror of https://github.com/hustcer/deepseek-review.git synced 2026-05-13 05:16:05 +08:00

5 Commits
v1 ... main

Author SHA1 Message Date
Justin Ma
9163ca2434 deps: Upgrade Nu to 0.112.2 & hustcer/setup-nu to v3.23 (#202)
* deps: Upgrade Nu to 0.112.2

* deps: Upgrade hustcer/setup-nu@v3.23
2026-05-07 21:24:17 +08:00
Xinnil
cb78a000a7 [RR] Add Trigger for Skipping CR (#199)
* new constants and check

* Update

* Delete comments
2026-05-07 21:05:53 +08:00
Xinnil
d1dcf1311d Review models Integration (#200)
* Update review.nu

Update model to preavoid depreciation

* Update refs

* Update payload in review

* Update the cr help
2026-05-07 20:57:52 +08:00
Justin Ma
6cbc5ef631 deps: Upgrade Nu to 0.111 (#198) 2026-03-01 15:55:32 +08:00
Justin Ma
92a3c2ae17 fix: Try to fix workflow error for Nu 0.111 (#197)
* fix: Try to fix workflow error for Nu 0.111

* chore: Update readme
2026-02-09 10:41:14 +08:00
10 changed files with 32 additions and 26 deletions

View File

@@ -7,8 +7,6 @@
[中文说明](README.zh-CN.md)
`deepseek-review` offers seamless integration with DeepSeek models on SiliconCloud. [Sign Up Now](https://cloud.siliconflow.cn/i/rqCdIxzS) to **claim your free 20 million tokens** and start exploring its capabilities!
## Features
### GitHub Action
@@ -121,7 +119,7 @@ With this setup, DeepSeek code review will not run automatically upon PR creatio
| Name | Type | Description |
| -------------- | ------ | ----------------------------------------------------------------------- |
| chat-token | String | Required, DeepSeek API Token |
| model | String | Optional, The model used for code review, defaults to `deepseek-chat` |
| model | String | Optional, The model used for code review, defaults to `deepseek-v4-flash` |
| base-url | String | Optional, DeepSeek API Base URL, defaults to `https://api.deepseek.com` |
| max-length | Int | Optional, Maximum length (Unicode width) of the content for review. If the content length exceeds this value, the review will be skipped. Default `0` means no limit. |
| sys-prompt | String | Optional, System prompt corresponding to `$sys_prompt` in the payload, default value see note below |
@@ -135,7 +133,7 @@ With this setup, DeepSeek code review will not run automatically upon PR creatio
```js
{
// `$model` default value: deepseek-chat
// `$model` default value: deepseek-v4-flash
model: $model,
stream: false,
temperature: $temperature,
@@ -164,7 +162,7 @@ With this setup, DeepSeek code review will not run automatically upon PR creatio
To perform code reviews locally (works on `macOS`, `Ubuntu`, and `Windows`), you need to install the following tools:
- [`Nushell`](https://www.nushell.sh/book/installation.html). It is recommended to install the latest version (minimum version required: `0.110.0`).
- [`Nushell`](https://www.nushell.sh/book/installation.html). It is recommended to install the latest version (minimum version required: `0.112.2`).
- The latest version of [`awk`](https://github.com/onetrueawk/awk) or [`gawk`](https://www.gnu.org/software/gawk/) is required, with `gawk` being preferred.
- Clone this repository to your local machine, navigate to the repository directory, and run `nu cr -h`. You should see an output similar to the following:
@@ -183,7 +181,7 @@ Flags:
-t, --diff-to <string>: Git diff ending commit SHA
-c, --patch-cmd <string>: The `git show` or `git diff` command to get the diff content, for local CR only
-l, --max-length <int>: Maximum length of the content for review, 0 means no limit.
-m, --model <string>: Model name, or read from CHAT_MODEL env var, `deepseek-chat` by default
-m, --model <string>: Model name, or read from CHAT_MODEL env var, `deepseek-v4-flash` by default
-b, --base-url <string>: DeepSeek API base URL, fallback to BASE_URL env var
-U, --chat-url <string>: DeepSeek Model chat full API URL, e.g. http://localhost:11535/api/chat
-s, --sys-prompt <string>: Default to $DEFAULT_OPTIONS.SYS_PROMPT,

View File

@@ -5,8 +5,6 @@
![Failed](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgist.githubusercontent.com%2Fhustcer%2Fb99391ee59016b17d0befe3331387e89%2Fraw%2Ftest-summary.json&query=%24.failed&label=Failed&color=red)
![Skipped](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgist.githubusercontent.com%2Fhustcer%2Fb99391ee59016b17d0befe3331387e89%2Fraw%2Ftest-summary.json&query=%24.skipped&label=Skipped&color=yellow)
本工具也支持使用 SiliconCloud 上的 DeepSeek 模型,[注册](https://cloud.siliconflow.cn/i/rqCdIxzS) 就**免费赠送 2000 万 Token**,赶紧试试吧!
## 特性
### GitHub Action
@@ -119,7 +117,7 @@ jobs:
| 名称 | 类型 | 描述 |
| -------------- | ------ | -------------------------------------------------------------- |
| chat-token | String | 必填DeepSeek API Token |
| model | String | 可选,配置代码审查选用的模型,默认为 `deepseek-chat` |
| model | String | 可选,配置代码审查选用的模型,默认为 `deepseek-v4-flash` |
| base-url | String | 可选DeepSeek API Base URL, 默认为 `https://api.deepseek.com` |
| max-length | Int | 可选,待审查内容的最大 Unicode 长度, 默认 `0` 表示没有限制,超过非零值则跳过审查 |
| sys-prompt | String | 可选,系统提示词对应入参中的 `$sys_prompt`, 默认值见后文注释 |
@@ -133,7 +131,7 @@ DeepSeek 接口调用入参:
```js
{
// `$model` default value: deepseek-chat
// `$model` default value: deepseek-v4-flash
model: $model,
stream: false,
temperature: $temperature,
@@ -161,7 +159,7 @@ DeepSeek 接口调用入参:
在本地进行代码审查,支持 `macOS`, `Ubuntu` & `Windows` 不过需要安装以下工具:
- [`Nushell`](https://www.nushell.sh/book/installation.html), 建议安装最新版本(最低版本 `0.110.0`)
- [`Nushell`](https://www.nushell.sh/book/installation.html), 建议安装最新版本(最低版本 `0.112.2`)
- [`awk`](https://github.com/onetrueawk/awk) 或者 [`gawk`](https://www.gnu.org/software/gawk/) 的最新版版本,优先推荐 `gawk`
- 接下来只需要把本仓库代码克隆到本地,然后进入仓库目录执行 `nu cr -h` 即可看到类似如下输出:
@@ -180,7 +178,7 @@ Flags:
-t, --diff-to <string>: Git diff ending commit SHA
-c, --patch-cmd <string>: The `git show` or `git diff` command to get the diff content, for local CR only
-l, --max-length <int>: Maximum length of the content for review, 0 means no limit.
-m, --model <string>: Model name, or read from CHAT_MODEL env var, `deepseek-chat` by default
-m, --model <string>: Model name, or read from CHAT_MODEL env var, `deepseek-v4-flash` by default
-b, --base-url <string>: DeepSeek API base URL, fallback to BASE_URL env var
-U, --chat-url <string>: DeepSeek Model chat full API URL, e.g. http://localhost:11535/api/chat
-s, --sys-prompt <string>: Default to $DEFAULT_OPTIONS.SYS_PROMPT,

View File

@@ -24,7 +24,7 @@ inputs:
description: 'The maximum length of the content for review, 0 means no limit.'
model:
required: false
default: 'deepseek-chat'
default: 'deepseek-v4-flash'
description: 'The DeepSeek model to choose for code review.'
temperature:
required: false
@@ -58,9 +58,9 @@ runs:
using: 'composite'
steps:
- name: Setup Nu
uses: hustcer/setup-nu@v3.22
uses: hustcer/setup-nu@v3.23
with:
version: 0.110.0
version: 0.112.2
- name: DeepSeek Code Review
shell: nu {0}

View File

@@ -50,7 +50,7 @@ providers:
token: 'YOUR_DEEPSEEK_TOKEN' # Required, The API token for the provider
base-url: 'https://api.deepseek.com'
models:
- name: 'deepseek-chat' # Required, Pass the model name to --model flag to use it
- name: 'deepseek-v4-flash' # Required, Pass the model name to --model flag to use it
alias: v3 # Optional, Alias name could also be passed to --model flag
enabled: true # One and Only one model could be enabled in one model group
description: 'DeepSeek V3' # Optional, Description of the model, won't be used actually

2
cr
View File

@@ -18,7 +18,7 @@ def main [
--diff-to(-t): string, # Git diff ending commit SHA
--patch-cmd(-c): string, # The `git show` or `git diff` command to get the diff content, for local CR only
--max-length(-l): int, # Maximum length of the content for review, 0 means no limit.
--model(-m): string, # Model name, or read from CHAT_MODEL env var, `deepseek-chat` by default
--model(-m): string, # Model name, or read from CHAT_MODEL env var, `deepseek-v4-flash` by default
--base-url(-b): string, # DeepSeek API base URL, fallback to BASE_URL env var
--chat-url(-U): string, # DeepSeek Model chat full API URL, e.g. http://localhost:11535/api/chat
--sys-prompt(-s): string # Default to $DEFAULT_OPTIONS.SYS_PROMPT,

View File

@@ -20,6 +20,7 @@ words:
- hustcer
- Nushell
- creatio
- pipefail
- justfile
- lefthook
- deepseek

View File

@@ -193,7 +193,8 @@ export def git-check [
# Check if current directory is a git repo
export def is-repo [] {
let checkRepo = try {
do -i { git rev-parse --is-inside-work-tree } | complete
# Put `complete` inside `do` block to avoid pipefail error in Nushell 0.110+
do { git rev-parse --is-inside-work-tree | complete }
} catch {
({ stdout: 'false' })
}
@@ -205,8 +206,8 @@ export def has-ref [
ref: string # The git ref to check
] {
if not (is-repo) { return false }
# Brackets were required here, or error will occur
let parse = (do -i { git rev-parse --verify -q $ref } | complete)
# Put `complete` inside `do` block to avoid pipefail error in Nushell 0.110+
let parse = (do { git rev-parse --verify -q $ref | complete })
if ($parse.stdout | is-empty) { false } else { true }
}

View File

@@ -80,6 +80,13 @@ def get-pr-diff [
exit $ECODE.SUCCESS
}
let commit_msg = http get -H $BASE_HEADER $'($GITHUB_API_BASE)/repos/($repo)/pulls/($pr_number)/commits'
| last | get commit.message
if ($IGNORE_REVIEW_KEYWORDS | any {|it| $commit_msg =~ $it }) {
print $'(ansi r)The latest PR commit message contains keywords to skip the review, bye...(ansi reset)'
exit $ECODE.SUCCESS
}
# Get the diff content of the PR
http get -H $DIFF_HEADER $'($GITHUB_API_BASE)/repos/($repo)/pulls/($pr_number)' | str trim
}

View File

@@ -46,9 +46,9 @@ export def 'make-release' [
export def has-ref [
ref: string # The git ref to check
] {
let checkRepo = (do -i { git rev-parse --is-inside-work-tree } | complete)
# Put `complete` inside `do` block to avoid pipefail error in Nushell 0.110+
let checkRepo = (do { git rev-parse --is-inside-work-tree | complete })
if not ($checkRepo.stdout =~ 'true') { return false }
# Brackets were required here, or error will occur
let parse = (do -i { git rev-parse --verify -q $ref } | complete)
let parse = (do { git rev-parse --verify -q $ref | complete })
if ($parse.stdout | is-empty) { false } else { true }
}

View File

@@ -43,7 +43,7 @@ const IGNORED_MESSAGES = {
const HTTP_HEADERS = [User-Agent curl/8.9]
const DEFAULT_OPTIONS = {
MODEL: 'deepseek-chat',
MODEL: 'deepseek-v4-flash',
TEMPERATURE: 0.3,
BASE_URL: 'https://api.deepseek.com',
USER_PROMPT: 'Please review the following code changes:',
@@ -62,7 +62,7 @@ export def --env deepseek-review [
--diff-from(-f): string, # Git diff starting commit SHA
--patch-cmd(-c): string, # The `git show` or `git diff` command to get the diff content, for local CR only
--max-length(-l): int, # Maximum length of the content for review, 0 means no limit.
--model(-m): string, # Model name, or read from CHAT_MODEL env var, `deepseek-chat` by default
--model(-m): string, # Model name, or read from CHAT_MODEL env var, `deepseek-v4-flash` by default
--base-url(-b): string, # DeepSeek API base URL, fallback to BASE_URL env var
--chat-url(-U): string, # DeepSeek Model chat full API URL, e.g. http://localhost:11535/api/chat
--sys-prompt(-s): string # Default to $DEFAULT_OPTIONS.SYS_PROMPT,
@@ -135,7 +135,8 @@ export def --env deepseek-review [
messages: [
{ role: 'system', content: $sys_prompt },
{ role: 'user', content: $"($user_prompt):\n($content)" }
]
],
thinking: { type: 'disabled' }
}
if $debug { print $'(char nl)Code Changes:'; hr-line; print $content }
print $'(char nl)Waiting for response from (ansi g)($url)(ansi reset) ...'