Compare commits

..

26 Commits

Author SHA1 Message Date
360888887f Merge pull request '更新 .gitea/workflows/test.yml' (#41) from james-patch-28 into main
Reviewed-on: #41
2025-07-28 00:28:37 +08:00
653dbc0dc9 更新 .gitea/workflows/test.yml
All checks were successful
Run Unit Tests / test (pull_request) Successful in 16s
2025-07-28 00:28:05 +08:00
834810a69c Merge pull request '更新 .gitea/workflows/test.yml' (#39) from james-patch-23 into main
Reviewed-on: #39
2025-07-28 00:02:23 +08:00
724f406739 更新 .gitea/workflows/test.yml
All checks were successful
Run Unit Tests / test (pull_request) Successful in 5s
2025-07-28 00:01:42 +08:00
21c0354e21 Merge pull request '更新 .gitea/workflows/test.yml' (#38) from james-patch-22 into main
Reviewed-on: #38
2025-07-27 23:58:47 +08:00
1c6b2cbb88 更新 .gitea/workflows/test.yml
All checks were successful
Run Unit Tests / test (pull_request) Successful in 9s
2025-07-27 23:58:02 +08:00
644a797b79 Merge pull request '更新 .gitea/workflows/test.yml' (#37) from james-patch-25 into main
Reviewed-on: #37
2025-07-27 23:48:01 +08:00
774278f283 更新 .gitea/workflows/test.yml
All checks were successful
Run Unit Tests / test (pull_request) Successful in 3s
2025-07-27 23:47:36 +08:00
ac2e68cb8a Merge pull request '更新 .gitea/workflows/test.yml' (#36) from james-patch-24 into main
Reviewed-on: #36
2025-07-27 23:45:58 +08:00
250dd1e327 更新 .gitea/workflows/test.yml
All checks were successful
Run Unit Tests / test (pull_request) Successful in 3s
2025-07-27 23:45:35 +08:00
3622c20df2 Merge pull request '更新 .gitea/workflows/test.yml' (#33) from james-patch-21 into main
Reviewed-on: #33
2025-07-27 23:30:04 +08:00
52753e56d1 更新 .gitea/workflows/test.yml
All checks were successful
Run Unit Tests / test (pull_request) Successful in 3s
2025-07-27 23:29:22 +08:00
0e2da9efb8 Merge pull request '更新 .gitea/workflows/test.yml' (#32) from james-patch-20 into main
Reviewed-on: #32
2025-07-27 22:27:11 +08:00
b59e66eca8 更新 .gitea/workflows/test.yml
All checks were successful
Run Unit Tests / test (pull_request) Successful in 3s
2025-07-27 22:26:58 +08:00
589458fbbe Merge pull request '更新 .gitea/workflows/test.yml' (#27) from james-patch-16 into main
Reviewed-on: #27
2025-07-27 01:08:04 +08:00
11eea452eb 更新 .gitea/workflows/test.yml
All checks were successful
Run Unit Tests / test (pull_request) Successful in 3s
2025-07-27 01:07:45 +08:00
b3864c9dfb Merge pull request '更新 .gitea/workflows/test.yml' (#25) from james-patch-14 into main
Reviewed-on: #25
2025-07-27 01:01:07 +08:00
a15381cced 更新 .gitea/workflows/test.yml
All checks were successful
Run Unit Tests / test (pull_request) Successful in 3s
2025-07-27 01:00:53 +08:00
895bba2db7 更新 .gitea/workflows/test.yml
Some checks failed
Run Unit Tests / test (pull_request) Has been cancelled
2025-07-27 00:53:28 +08:00
70385e0d5e Merge pull request '更新 .gitea/workflows/test.yml' (#24) from james-patch-13 into main
Reviewed-on: #24
2025-07-27 00:52:03 +08:00
a9bb675fda 更新 .gitea/workflows/test.yml
Some checks failed
Run Unit Tests / test (pull_request) Has been cancelled
2025-07-27 00:51:44 +08:00
1889294704 更新 .gitea/workflows/test.yml
Some checks failed
Run Unit Tests / test (pull_request) Has been cancelled
2025-07-27 00:47:48 +08:00
f18e3f2a92 Merge pull request '更新 .gitea/workflows/test.yml' (#22) from james-patch-122 into main
Reviewed-on: #22
2025-07-26 19:33:08 +08:00
d51bbb2f85 更新 .gitea/workflows/test.yml
All checks were successful
Run Unit Tests / test (pull_request) Successful in 3s
2025-07-26 19:32:20 +08:00
f01ad0fa47 更新 .gitea/workflows/test.yml 2025-07-26 19:30:03 +08:00
8cb457c778 更新 .gitea/workflows/test.yml 2025-07-26 19:29:32 +08:00

View File

@ -1,41 +1,74 @@
name: Run Unit Tests
on:
pull_request:
branches:
- main
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
jobs:
test:
runs-on: phpunit_test
container: docker.xuanyuan.me/hui369/sctmes-v5-runner:v3.0
container: mirror.ccs.tencentyun.com/xeden3/ai-code-reviewer-gitea-runner:v1.4.1
steps:
- name: Checkout code
uses: http://119.91.43.128:3003/james/checkout@v4
- name: Get Pull Request Number
id: get_pr_number
run: |
# 提取 PR 编号(如 pull/14/head -> 14)
PULLS_ID=$(git branch | grep -o 'pull/[0-9]\+' | cut -d'/' -f2)
if [ -z "$PULLS_ID" ]; then
echo "❌ 无法提取 PR 编号"
exit 1
fi
echo "PR ID: $PULLS_ID"
# 写入 GITHUB_ENV(可选,兼容旧脚本)
echo "PULLS_ID=$PULLS_ID" >> $GITHUB_ENV
# 写入 outputs,供后续步骤使用
echo "pr_number=$PULLS_ID" >> $GITHUB_OUTPUT
- name: Run code review script
env:
GIT_PROJECT_PATH: /workspace/MES/SCTMES_V5 # Gitea 的工作目录
# === 项目配置 ===
GIT_PROJECT_PATH: /workspace/hui/SCTMES_V5 # Gitea 的工作目录
ALLOWED_PATHS: '["EdgeManager/**", "mes_in_sct/**", "mes_in_task/**", "webman/**"]' # 允许检测目录
IGNORED_PATHS: '["EdgeManager/vendor/**", "mes_in_sct/vendor/**", "mes_in_task/vendor/**", "webman/public/**", "webman/runtime/**", "webman/vendor/**"]' # 忽略检测目录
# === Gitea API 配置(传给 audit_code.sh)===
API_URL: "http://119.91.43.128:3003/api/v1/repos/hui/SCTMES_V5/issues/${{ steps.get_pr_number.outputs.pr_number }}/comments"
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
SYSTEM_PROMPT: |
你是代码审核助手我需要你审核代码后以JSON形式输出通过(passed)或者不通过(no-passed)只输出json不添加其他说明。
只判断代码是否存在变量拼写错误并且在issues输出行数、出错语句及原因
忽略其他错误包括代码安全、SQL 语句内的错误、未定义的变量错误、未定义的方法错误、函数未定义错误、未定义的函数错误、PHP内置函数错误等
最终输出一定遵守以下JSON格式不允许出现其他格式
你是一位资深的PHP软件开发工程师专注于代码的规范性、功能性、稳定性、运行效率。本次任务是对员工的代码进行审查具体要求如下
### 代码审查目标:
1. 功能实现的正确性与健壮性40分 确保代码逻辑正确,能够处理各种边界情况和异常输入。
2. 命名规范10分检查代码变量和函数命名是否规范类和函数使用驼峰命名变量使用小写字母+下横线命名。
3. 是否符合最佳实践20分评估代码是否遵循行业最佳实践包括代码结构、命名规范、注释清晰度等。
4. 性能与资源利用效率20分分析代码的性能表现评估是否存在资源浪费或性能瓶颈。
5. Commits信息的清晰性与准确性10分检查提交信息是否清晰、准确是否便于后续维护和协作。
6. 所有检查**不需要考虑类名称不需要考虑SQL语句**,数据库注入风险等数据库相关的风险,**不考虑SQL预处理sprintf处理不需要考虑返回值命名$ret的情况**。
### 输出格式:
请以Markdown格式输出代码审查报告并包含以下内容
1. 问题描述和优化建议(如果有):列出代码中存在的问题,简要说明其影响,并给出优化建议,**必要时候以代码段的形式指出具体的修改方案**。
2. 评分明细:为每个评分标准提供具体分数。
3. 总分:格式为“总分:XX分”例如总分:80分确保可通过正则表达式 r"总分[:]\s*(\d+)分?" 解析出总分。
### 特别说明:
整个评论要保持sarcastic风格
评论时请大胆使用讽刺性语言,但要确保技术指正准确。
{
"status": "no-passed",
"issues": [
{
"line": 105,
"reason": "变量命名xxx不符合规范"
}
]
}
如果没有发现相关问题请一定输出以下JSON格式
{"status": "passed"}
评论时请:
1. 在技术点评中加入适当幽默元素
2. 合理使用相关Emoji但不要过度
- 🐛 表示bug
- 💥 表示严重问题
- 🎯 表示改进建议
- 🔍 表示需要仔细检查
run: |
cd /workspace
./audit_code.sh