Skip to content

Commit 6d8a973

Browse files
committed
chore(检验): 检测ScriptsPath.json是否变动,防无意义修改
1 parent f761d46 commit 6d8a973

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

utils/update_scripts_list.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import argparse
22
import os
33

4-
from helper import format_str, get_repo_name, read_json
4+
from helper import format_str, get_repo_name, read_json, is_file_updated_more_than
55
from searcher import search_in_file
66
from writer import process_file
77

@@ -148,6 +148,9 @@ def main():
148148
LANG_CODE = args.lang_code
149149
json_file_path = args.json_file_path
150150
readme_path = args.readme_path
151+
if is_file_updated_more_than(json_file_path, 5):
152+
print("跳过文件 ,因为ScriptsPath.json在五分钟之内没有新提交。")
153+
return
151154
data = read_json(json_file_path)
152155
sorted_scripts = sorted(data.get('scripts', []), key=lambda x: x['greasyfork_id'] if x.get('greasyfork_id') is not None else 0)
153156
related_scripts_map = generate_description(sorted_scripts)

0 commit comments

Comments
 (0)