mirror of
https://github.com/hustcer/deepseek-review.git
synced 2026-05-13 05:16:05 +08:00
96 lines
3.4 KiB
YAML
96 lines
3.4 KiB
YAML
# DeepSeek Code Review Action
|
||
# @author: hustcer
|
||
# @created: 2025/01/29 13:05:20
|
||
# REF:
|
||
# - https://docs.github.com/cn/actions/creating-actions/about-custom-actions
|
||
# - https://docs.github.com/cn/actions/creating-actions/metadata-syntax-for-github-actions
|
||
# - https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
|
||
|
||
name: 'DeepSeek CR'
|
||
author: 'hustcer'
|
||
description: '🚀 Sharpen Your Code, Ship with Confidence – Elevate Your Workflow with DeepSeek Code Review 🚀'
|
||
|
||
branding:
|
||
icon: 'eye'
|
||
color: 'purple'
|
||
|
||
inputs:
|
||
chat-token:
|
||
required: true
|
||
description: 'Your DeepSeek API token.'
|
||
max-length:
|
||
default: 0
|
||
required: false
|
||
description: 'The maximum length of the content for review, 0 means no limit.'
|
||
model:
|
||
required: false
|
||
default: 'deepseek-v4-flash'
|
||
description: 'The DeepSeek model to choose for code review.'
|
||
temperature:
|
||
required: false
|
||
default: 0.3
|
||
description: 'The temperature of the model.'
|
||
base-url:
|
||
required: false
|
||
default: 'https://api.deepseek.com'
|
||
description: 'The base url of DeepSeek API.'
|
||
sys-prompt:
|
||
required: false
|
||
default: 'You are a professional code review assistant responsible for analyzing code changes in GitHub Pull Requests. Identify potential issues such as code style violations, logical errors, security vulnerabilities, and provide improvement suggestions. Clearly list the problems and recommendations in a concise manner.'
|
||
description: 'The system prompt for DeepSeek API.'
|
||
user-prompt:
|
||
required: false
|
||
default: 'Please review the following code changes'
|
||
description: 'The user prompt for DeepSeek API.'
|
||
include-patterns:
|
||
required: false
|
||
description: 'The comma separated file patterns to include in the code review.'
|
||
exclude-patterns:
|
||
required: false
|
||
default: 'pnpm-lock.yaml,package-lock.json,*.lock'
|
||
description: 'The comma separated file patterns to exclude in the code review.'
|
||
github-token:
|
||
required: false
|
||
default: '${{ github.token }}'
|
||
description: 'The GITHUB_TOKEN secret or personal access token to authenticate. Defaults to `github.token`.'
|
||
|
||
runs:
|
||
using: 'composite'
|
||
steps:
|
||
- name: Setup Nu
|
||
uses: hustcer/setup-nu@v3.23
|
||
with:
|
||
version: 0.112.2
|
||
|
||
- name: DeepSeek Code Review
|
||
shell: nu {0}
|
||
run: |
|
||
const NU_LIB_DIRS = [ ${{ github.action_path }}/nu ]
|
||
use review.nu *
|
||
let model = '${{ inputs.model }}'
|
||
let baseUrl = '${{ inputs.base-url }}'
|
||
let repo = '${{ github.repository }}'
|
||
let token = '${{ inputs.chat-token }}'
|
||
let ghToken = '${{ inputs.github-token }}'
|
||
let sysPrompt = '${{ inputs.sys-prompt }}'
|
||
let userPrompt = '${{ inputs.user-prompt }}'
|
||
let pr = '${{ github.event.pull_request.number }}'
|
||
let includePatterns = '${{ inputs.include-patterns }}'
|
||
let excludePatterns = '${{ inputs.exclude-patterns }}'
|
||
let maxLength = try { '${{ inputs.max-length }}' | into int } catch { 0 }
|
||
let temperature = try { '${{ inputs.temperature }}' | into float } catch { 0.3 }
|
||
(deepseek-review $token
|
||
--model $model
|
||
--repo $repo
|
||
--pr-number $pr
|
||
--gh-token $ghToken
|
||
--base-url $baseUrl
|
||
--max-length $maxLength
|
||
--sys-prompt $sysPrompt
|
||
--user-prompt $userPrompt
|
||
--temperature $temperature
|
||
--include $includePatterns
|
||
--exclude $excludePatterns
|
||
)
|
||
|