mirror of
https://github.com/ACL4SSR/ACL4SSR.git
synced 2026-06-13 07:52:31 +00:00
fix a bug
This commit is contained in:
47
.github/workflows/update.yml
vendored
47
.github/workflows/update.yml
vendored
@@ -16,6 +16,7 @@ jobs:
|
|||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: master
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v6
|
||||||
@@ -82,16 +83,34 @@ jobs:
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 检查 YAML 文件是否有有效内容(排除 payload: 和空行/注释行)
|
||||||
|
has_yaml_content() {
|
||||||
|
local file=$1
|
||||||
|
local content_lines=$(sed '/^payload:$/d; /^#/d; /^$/d' "$file" | wc -l)
|
||||||
|
[ "$content_lines" -gt 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
# 检查 LIST 文件是否有有效内容(排除注释和空行)
|
||||||
|
has_list_content() {
|
||||||
|
local file=$1
|
||||||
|
local content_lines=$(sed '/^#/d; /^$/d' "$file" | wc -l)
|
||||||
|
[ "$content_lines" -gt 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
# 处理所有分离文件(包括生成的和已存在的)
|
# 处理所有分离文件(包括生成的和已存在的)
|
||||||
for file in Clash/Providers/*_domain.yaml Clash/Providers/*_ip.yaml Clash/Providers/Ruleset/*_domain.yaml Clash/Providers/Ruleset/*_ip.yaml; do
|
for file in Clash/Providers/*_domain.yaml Clash/Providers/*_ip.yaml Clash/Providers/Ruleset/*_domain.yaml Clash/Providers/Ruleset/*_ip.yaml; do
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
filename=$(basename "$file")
|
filename=$(basename "$file")
|
||||||
if [[ "$filename" == *"_domain.yaml" ]]; then
|
if has_yaml_content "$file"; then
|
||||||
base=$(basename "$file" _domain.yaml)
|
if [[ "$filename" == *"_domain.yaml" ]]; then
|
||||||
convert_file "domain" "yaml" "$file" "Clash/mrs/${base}_domain.mrs"
|
base=$(basename "$file" _domain.yaml)
|
||||||
elif [[ "$filename" == *"_ip.yaml" ]]; then
|
convert_file "domain" "yaml" "$file" "Clash/mrs/${base}_domain.mrs"
|
||||||
base=$(basename "$file" _ip.yaml)
|
elif [[ "$filename" == *"_ip.yaml" ]]; then
|
||||||
convert_file "ipcidr" "yaml" "$file" "Clash/mrs/${base}_ip.mrs"
|
base=$(basename "$file" _ip.yaml)
|
||||||
|
convert_file "ipcidr" "yaml" "$file" "Clash/mrs/${base}_ip.mrs"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Skipping empty or invalid file: $file"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -99,12 +118,16 @@ jobs:
|
|||||||
for file in Clash/Ruleset/*_domain.list Clash/Ruleset/*_ip.list; do
|
for file in Clash/Ruleset/*_domain.list Clash/Ruleset/*_ip.list; do
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
filename=$(basename "$file")
|
filename=$(basename "$file")
|
||||||
if [[ "$filename" == *"_domain.list" ]]; then
|
if has_list_content "$file"; then
|
||||||
base=$(basename "$file" _domain.list)
|
if [[ "$filename" == *"_domain.list" ]]; then
|
||||||
convert_file "domain" "text" "$file" "Clash/mrs/${base}_domain.mrs"
|
base=$(basename "$file" _domain.list)
|
||||||
elif [[ "$filename" == *"_ip.list" ]]; then
|
convert_file "domain" "text" "$file" "Clash/mrs/${base}_domain.mrs"
|
||||||
base=$(basename "$file" _ip.list)
|
elif [[ "$filename" == *"_ip.list" ]]; then
|
||||||
convert_file "ipcidr" "text" "$file" "Clash/mrs/${base}_ip.mrs"
|
base=$(basename "$file" _ip.list)
|
||||||
|
convert_file "ipcidr" "text" "$file" "Clash/mrs/${base}_ip.mrs"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Skipping empty or invalid file: $file"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user