@@ -31,45 +31,79 @@ jobs:
31
31
- name : Check for duplicate filenames
32
32
id : check
33
33
run : |
34
- echo "Checking for duplicate filenames between HTML_見送り and HTML_未着手 folders..."
34
+ echo "Checking for duplicate filenames across HTML, HTML_見送り, and HTML_未着手 folders..."
35
35
36
- # Get basenames from both directories
37
- dir1_files=$(find "WAIC-TEST/HTML_見送り" -name "*.md" -exec basename {} \; 2>/dev/null | sort)
38
- dir2_files=$(find "WAIC-TEST/HTML_未着手" -name "*.md" -exec basename {} \; 2>/dev/null | sort)
36
+ # Get basenames from all three directories
37
+ html_files=$(find "WAIC-TEST/HTML" -name "*.md" ! -name "README.md" -exec basename {} \; 2>/dev/null | sort)
38
+ miokuri_files=$(find "WAIC-TEST/HTML_見送り" -name "*.md" -exec basename {} \; 2>/dev/null | sort)
39
+ michakushu_files=$(find "WAIC-TEST/HTML_未着手" -name "*.md" -exec basename {} \; 2>/dev/null | sort)
39
40
40
- # Find duplicates
41
- duplicates=$(comm -12 <(echo "$dir1_files") <(echo "$dir2_files"))
41
+ # Find duplicates and files to delete
42
+ issue_body=""
43
+ files_to_delete=""
44
+ duplicates_found=false
42
45
43
- if [ -n "$duplicates" ]; then
44
- echo "❌ Duplicate filenames found:"
45
- echo "$duplicates"
46
+ # Check HTML vs HTML_未着手 (delete from HTML_未着手)
47
+ html_vs_michakushu=$(comm -12 <(echo "$html_files") <(echo "$michakushu_files"))
48
+ if [ -n "$html_vs_michakushu" ]; then
49
+ echo "❌ Duplicates found between HTML and HTML_未着手:"
50
+ duplicates_found=true
51
+ for file in $html_vs_michakushu; do
52
+ echo " - $file"
53
+ html_path=$(find WAIC-TEST/HTML -name "$file" -exec echo {} \;)
54
+ michakushu_path=$(find WAIC-TEST/HTML_未着手 -name "$file" -exec echo {} \;)
55
+ echo " 📁 HTML: $html_path"
56
+ echo " 📁 HTML_未着手: $michakushu_path (削除対象)"
57
+ issue_body="$issue_body- \`$file\`\n - 📁 HTML: \`$html_path\`\n - 📁 HTML_未着手: \`$michakushu_path\` (削除対象)\n\n"
58
+ files_to_delete="$files_to_delete$michakushu_path\n"
59
+ done
46
60
echo ""
47
- echo "Files exist in both HTML_見送り and HTML_未着手:"
48
-
49
- # Create detailed list for issue and files to delete
50
- issue_body=""
51
- files_to_delete=""
52
- for file in $duplicates; do
61
+ fi
62
+
63
+ # Check HTML vs HTML_見送り (delete from HTML_見送り)
64
+ html_vs_miokuri=$(comm -12 <(echo "$html_files") <(echo "$miokuri_files"))
65
+ if [ -n "$html_vs_miokuri" ]; then
66
+ echo "❌ Duplicates found between HTML and HTML_見送り:"
67
+ duplicates_found=true
68
+ for file in $html_vs_miokuri; do
69
+ echo " - $file"
70
+ html_path=$(find WAIC-TEST/HTML -name "$file" -exec echo {} \;)
71
+ miokuri_path=$(find WAIC-TEST/HTML_見送り -name "$file" -exec echo {} \;)
72
+ echo " 📁 HTML: $html_path"
73
+ echo " 📁 HTML_見送り: $miokuri_path (削除対象)"
74
+ issue_body="$issue_body- \`$file\`\n - 📁 HTML: \`$html_path\`\n - 📁 HTML_見送り: \`$miokuri_path\` (削除対象)\n\n"
75
+ files_to_delete="$files_to_delete$miokuri_path\n"
76
+ done
77
+ echo ""
78
+ fi
79
+
80
+ # Check HTML_見送り vs HTML_未着手 (delete from HTML_未着手)
81
+ miokuri_vs_michakushu=$(comm -12 <(echo "$miokuri_files") <(echo "$michakushu_files"))
82
+ if [ -n "$miokuri_vs_michakushu" ]; then
83
+ echo "❌ Duplicates found between HTML_見送り and HTML_未着手:"
84
+ duplicates_found=true
85
+ for file in $miokuri_vs_michakushu; do
53
86
echo " - $file"
54
87
miokuri_path=$(find WAIC-TEST/HTML_見送り -name "$file" -exec echo {} \;)
55
88
michakushu_path=$(find WAIC-TEST/HTML_未着手 -name "$file" -exec echo {} \;)
56
- echo " 📁 HTML_見送り/ $miokuri_path"
57
- echo " 📁 HTML_未着手/ $michakushu_path"
58
- issue_body="$issue_body- \`$file\`\n - 📁 \`$miokuri_path\`\n - 📁 \`$michakushu_path\`\n\n"
89
+ echo " 📁 HTML_見送り: $miokuri_path"
90
+ echo " 📁 HTML_未着手: $michakushu_path (削除対象) "
91
+ issue_body="$issue_body- \`$file\`\n - 📁 HTML_見送り: \`$miokuri_path\`\n - 📁 HTML_未着手: \`$michakushu_path\` (削除対象) \n\n"
59
92
files_to_delete="$files_to_delete$michakushu_path\n"
60
93
done
61
-
94
+ echo ""
95
+ fi
96
+
97
+ if [ "$duplicates_found" = true ]; then
62
98
echo "duplicates_found=true" >> $GITHUB_OUTPUT
63
99
echo "duplicate_list<<EOF" >> $GITHUB_OUTPUT
64
100
echo -e "$issue_body" >> $GITHUB_OUTPUT
65
101
echo "EOF" >> $GITHUB_OUTPUT
66
102
echo "files_to_delete<<EOF" >> $GITHUB_OUTPUT
67
103
echo -e "$files_to_delete" >> $GITHUB_OUTPUT
68
104
echo "EOF" >> $GITHUB_OUTPUT
69
-
70
- # Don't fail, proceed to auto-fix
71
105
else
72
- echo "✅ No duplicate filenames found between the two directories."
106
+ echo "✅ No duplicate filenames found across all directories."
73
107
echo "duplicates_found=false" >> $GITHUB_OUTPUT
74
108
fi
75
109
83
117
with :
84
118
token : ${{ secrets.GITHUB_TOKEN }}
85
119
86
- - name : Delete duplicate files from HTML_未着手
120
+ - name : Delete duplicate files
87
121
run : |
88
- echo "Deleting duplicate files from HTML_未着手 folder ..."
122
+ echo "Deleting duplicate files..."
89
123
90
124
# Delete files listed in files_to_delete
91
125
echo -e "${{ needs.check-duplicates.outputs.files_to_delete }}" | while read -r file; do
@@ -99,18 +133,18 @@ jobs:
99
133
uses : peter-evans/create-pull-request@v7
100
134
with :
101
135
token : ${{ secrets.GITHUB_TOKEN }}
102
- commit-message : " 🗑️ Remove duplicate files from HTML_未着手 folder [skip ci]"
103
- title : " 🗑️ 重複ファイルの自動削除 (HTML_未着手) "
136
+ commit-message : " 🗑️ Remove duplicate files across HTML folders [skip ci]"
137
+ title : " 🗑️ 重複ファイルの自動削除"
104
138
body : |
105
139
## 概要
106
- HTML_見送り と HTML_未着手 フォルダ間で重複するファイルを検出し、HTML_未着手 から自動削除しました 。
140
+ HTML、 HTML_見送り、 HTML_未着手 フォルダ間で重複するファイルを検出し、優先度の低いフォルダから自動削除しました 。
107
141
108
142
## 削除されたファイル
109
143
${{ needs.check-duplicates.outputs.duplicate_list }}
110
144
111
- ## 削除理由
112
- - ファイルが HTML_見送り フォルダに既に存在するため
113
- - 重複を避けるために HTML_未着手 から削除
145
+ ## 削除ルール
146
+ - 優先度: HTML > HTML_見送り > HTML_未着手
147
+ - 重複が見つかった場合、優先度の低い方から削除
114
148
115
149
## 確認事項
116
150
- [ ] 削除されたファイルの内容が HTML_見送り のファイルと同一であることを確認
0 commit comments