From 82afd0715f1801931b08b40bf6e62a7ec403afa5 Mon Sep 17 00:00:00 2001 From: AllenWriter Date: Fri, 14 Feb 2025 11:47:30 +0800 Subject: [PATCH] Feat/update ai docs lang check action (#510) * Feat: update auto lang check script * Feat: update auto lang check script, enable api check * Feat: update github auto check * Feat: update github auto check file * Feat: update github auto check file * Feat: hide secret key * Feat: test app key update * Feat: hide app key * Feat: add automatic file deletion --- .github/workflows/lang-check.yml | 4 ++++ .gitignore | 1 + lang-check/.env.example | 1 + lang-check/commit-96732-0214.txt | 14 ++++++++++++++ lang-check/git-diff.sh | 2 +- lang-check/test.md | 7 ------- 6 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 lang-check/.env.example create mode 100644 lang-check/commit-96732-0214.txt delete mode 100644 lang-check/test.md diff --git a/.github/workflows/lang-check.yml b/.github/workflows/lang-check.yml index e42e999c..0f8c2bcd 100644 --- a/.github/workflows/lang-check.yml +++ b/.github/workflows/lang-check.yml @@ -36,9 +36,13 @@ jobs: # 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 else + # Clean up temporary file before exit + rm -f ./lang-check/commit-*.txt echo "Check passed" exit 0 # Zero exit code indicates Action success fi \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0f821530..2008dd33 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ venv/ ENV/ env.bak/ venv.bak/ +lang-check/.env # Pyre type checker .pyre/ diff --git a/lang-check/.env.example b/lang-check/.env.example new file mode 100644 index 00000000..4d926563 --- /dev/null +++ b/lang-check/.env.example @@ -0,0 +1 @@ +DIFY_API_KEY=your_api_key_here \ No newline at end of file diff --git a/lang-check/commit-96732-0214.txt b/lang-check/commit-96732-0214.txt new file mode 100644 index 00000000..df5c7cc3 --- /dev/null +++ b/lang-check/commit-96732-0214.txt @@ -0,0 +1,14 @@ + + +# 一个文档 + +不加xxx中英文空格 + +- xxxx + +https://langgenius.feishu.cn/ + +测试31231三大 + + + diff --git a/lang-check/git-diff.sh b/lang-check/git-diff.sh index 8dfe9cf5..12587171 100755 --- a/lang-check/git-diff.sh +++ b/lang-check/git-diff.sh @@ -55,7 +55,7 @@ if [ "$debug_mode" = true ]; then fi # 设置 API 密钥和其他常量 -api_key="app-jlPYjfHIRLXbSoy9gw3ZOyXw" +api_key="${DIFY_API_KEY}" user=$(git config user.name) # 获取 Git 配置中的用户名 # 如果获取失败,使用默认值 diff --git a/lang-check/test.md b/lang-check/test.md deleted file mode 100644 index 304db950..00000000 --- a/lang-check/test.md +++ /dev/null @@ -1,7 +0,0 @@ -# 一个文档 - -不加xxx中英文空格 - -- xxxx - -https://langgenius.feishu.cn/ \ No newline at end of file