mirror of
https://github.com/langgenius/dify-docs-archived.git
synced 2026-06-30 20:37:57 -04:00
feat/git tcommit (#511)
* Feat: add husky and test * Feat: add husky and test md file * Feat: add husky and test md file * Feat: add husky and test md file and test it * Feat: add husky and test md file and test it * Feat: update git commit -t parameters * Feat: delete husky * Feat: remove action's auto delation * Feat: update action file * Feat: delete test md file
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
name: Automatic Language Check
|
||||
name: Language Check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
paths:
|
||||
- '**.md' # Only trigger on markdown file changes
|
||||
- '**.md' # 只在 markdown 文件变更时触发
|
||||
|
||||
jobs:
|
||||
lang-check:
|
||||
@@ -14,7 +14,7 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Get full git history for diff comparison
|
||||
fetch-depth: 0 # 获取完整的 git 历史,以便进行 diff 比较
|
||||
|
||||
- name: Setup Git
|
||||
run: |
|
||||
@@ -32,17 +32,13 @@ jobs:
|
||||
run: |
|
||||
chmod +x ./lang-check/git-diff.sh
|
||||
output=$(./lang-check/git-diff.sh)
|
||||
echo "$output" # Display check results
|
||||
echo "$output" # 显示检查结果
|
||||
|
||||
# Check if output contains ❌ symbol
|
||||
# 检查输出中是否包含 ❌ 符号
|
||||
if echo "$output" | grep -q "❌"; then
|
||||
# Clean up temporary file before exit
|
||||
rm -f ./lang-check/commit-*.txt
|
||||
echo "Check failed, PR cannot be merged"
|
||||
exit 1 # Non-zero exit code will fail the Action
|
||||
echo "检查发现问题,PR 不予通过"
|
||||
exit 1 # 非零退出码会导致 Action 失败
|
||||
else
|
||||
# Clean up temporary file before exit
|
||||
rm -f ./lang-check/commit-*.txt
|
||||
echo "Check passed"
|
||||
exit 0 # Zero exit code indicates Action success
|
||||
echo "检查通过"
|
||||
exit 0 # 零退出码表示 Action 成功
|
||||
fi
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
<start---lang-check/lang-check/test.md---start>
|
||||
# 一个文档
|
||||
|
||||
不加xxx中英文空格
|
||||
|
||||
- xxxx
|
||||
|
||||
https://langgenius.feishu.cn/
|
||||
|
||||
测试31231三大
|
||||
|
||||
<end---/lang-check/test.md---end>
|
||||
|
||||
+25
-2
@@ -1,5 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 加载 .env 文件
|
||||
if [ -f "$(dirname "$0")/.env" ]; then
|
||||
source "$(dirname "$0")/.env"
|
||||
fi
|
||||
|
||||
# 检查环境变量是否存在
|
||||
if [ -z "${DIFY_API_KEY}" ]; then
|
||||
echo "错误:未设置 DIFY_API_KEY 环境变量"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 初始化调试模式标志
|
||||
debug_mode=false
|
||||
|
||||
@@ -124,8 +135,20 @@ fi
|
||||
# 检查 curl 是否成功
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "错误:API 请求超时或失败"
|
||||
# 清理临时文件
|
||||
rm -f "$log_file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 只输出 API 响应
|
||||
echo "$response"
|
||||
# 输出 API 响应
|
||||
echo "$response"
|
||||
|
||||
# 清理临时文件
|
||||
rm -f "$log_file"
|
||||
|
||||
# 检查响应中是否包含错误标记
|
||||
if echo "$response" | grep -q "❌"; then
|
||||
exit 1
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 运行语言检查脚本
|
||||
if bash ./lang-check/git-diff.sh; then
|
||||
# 检查通过,执行提交
|
||||
git commit -m "$*"
|
||||
else
|
||||
# 检查失败
|
||||
echo "Language check failed, commit aborted"
|
||||
exit 1
|
||||
fi
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "dify-docs",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
Reference in New Issue
Block a user