File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 7272 /^tag:/ {
7373 tag = substr($0, index($0, $2)) # 提取标签内容
7474 }
75- /^path:/ {
76- path = substr($0, index($0, $2)) # 提取路径内容
75+ /^path:/ {
76+ # 提取 path 字段并去除前后空格
77+ path = substr($0, index($0, $2))
78+ gsub(/^[ \t]+|[ \t]+$/, "", path) # 清理前后空格和制表符
7779 }
7880 /^owners:/ {
7981 owners = substr($0, index($0, $2)) # 提取维护者信息
@@ -93,14 +95,23 @@ jobs:
9395 touch triggered_reviewers.txt triggered_tags.txt # 确保文件存在
9496
9597 # 匹配路径并追加维护者信息
98+ # while IFS='|' read -r tag path reviewers; do
99+ # # 转义路径中的正则特殊字符
100+ # escaped_path=$(sed 's/[.[\*^$]/\\&/g' <<< "$path")
101+ # # 精确匹配路径及其子路径
102+ # if grep -qxE "$escaped_path(/.*)?" changed_files.txt; then
103+ # # 清理空格并移除空行后追加到文件
104+ # echo "$reviewers" | tr -s ' ' '\n' | sed '/^$/d' >> triggered_reviewers.txt
105+ # echo "$tag" >> triggered_tags.txt
106+ # fi
107+ # done < tag_data.csv
96108 while IFS='|' read -r tag path reviewers; do
97- # 转义路径中的正则特殊字符
98109 escaped_path=$(sed 's/[.[\*^$]/\\&/g' <<< "$path")
99- # 精确匹配路径及其子路径
110+ echo "Checking path: '$path' → escaped: '$escaped_path'" # 调试输出
100111 if grep -qxE "$escaped_path(/.*)?" changed_files.txt; then
101- # 清理空格并移除空行后追加到文件
102112 echo "$reviewers" | tr -s ' ' '\n' | sed '/^$/d' >> triggered_reviewers.txt
103113 echo "$tag" >> triggered_tags.txt
114+ echo "Matched! Tag: $tag, Path: $path" # 调试输出
104115 fi
105116 done < tag_data.csv
106117
You can’t perform that action at this time.
0 commit comments