From c51c165fc6ce725a3b49b94f27168d7f2233cb4e Mon Sep 17 00:00:00 2001 From: Haidong Wang Date: Mon, 16 Nov 2026 18:58:34 +0800 Subject: [PATCH 1/3] Create check_forbidden_files.yml --- .github/workflows/check_forbidden_files.yml | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/check_forbidden_files.yml diff --git a/.github/workflows/check_forbidden_files.yml b/.github/workflows/check_forbidden_files.yml new file mode 100644 index 00000000..bc18c7cc --- /dev/null +++ b/.github/workflows/check_forbidden_files.yml @@ -0,0 +1,23 @@ +name: Check Forbidden Files + +on: [push, pull_request] + +jobs: + check-files: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Fail if forbidden file extensions exist + run: | + # 查找指定后缀的文件,排除 .git 目录 + FILES=$(find . -path ./.git -prune -o \( -name "*.log" -o -name "*.tmp" \) -print) + + if [ -n "$FILES" ]; then + echo "❌ 错误:发现不允许的文件后缀:" + echo "$FILES" + exit 1 + fi + + echo "✅ 检查通过,未发现违规文件。" From 718448f76caf5a671a8a8b0b0f6e85a2811f3c94 Mon Sep 17 00:00:00 2001 From: Haidong Wang Date: Mon, 16 Nov 2026 19:07:29 +0800 Subject: [PATCH 2/3] Update check_forbidden_files.yml --- .github/workflows/check_forbidden_files.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_forbidden_files.yml b/.github/workflows/check_forbidden_files.yml index bc18c7cc..749def06 100644 --- a/.github/workflows/check_forbidden_files.yml +++ b/.github/workflows/check_forbidden_files.yml @@ -12,10 +12,10 @@ jobs: - name: Fail if forbidden file extensions exist run: | # 查找指定后缀的文件,排除 .git 目录 - FILES=$(find . -path ./.git -prune -o \( -name "*.log" -o -name "*.tmp" \) -print) + FILES=$(find . -path ./.git -prune -o \( -name "*.log" -o -name "*.tmp" -name "*.aux" -name "*.out" hutbthesis_main.pdf \) -print) if [ -n "$FILES" ]; then - echo "❌ 错误:发现不允许的文件后缀:" + echo "❌ 错误:发现不允许的文件:" echo "$FILES" exit 1 fi From fbd757fd905f7ec78c940b77553d89fb052b27c2 Mon Sep 17 00:00:00 2001 From: Haidong Wang Date: Mon, 16 Nov 2026 19:18:44 +0800 Subject: [PATCH 3/3] Update check_forbidden_files.yml --- .github/workflows/check_forbidden_files.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_forbidden_files.yml b/.github/workflows/check_forbidden_files.yml index 749def06..1a56f2b1 100644 --- a/.github/workflows/check_forbidden_files.yml +++ b/.github/workflows/check_forbidden_files.yml @@ -12,7 +12,7 @@ jobs: - name: Fail if forbidden file extensions exist run: | # 查找指定后缀的文件,排除 .git 目录 - FILES=$(find . -path ./.git -prune -o \( -name "*.log" -o -name "*.tmp" -name "*.aux" -name "*.out" hutbthesis_main.pdf \) -print) + FILES=$(find . -path ./.git -prune -o \( -name "*.log" -o -name "*.tmp" -name "*.aux" -name "*.out" -name hutbthesis_main.pdf \) -print) if [ -n "$FILES" ]; then echo "❌ 错误:发现不允许的文件:"