Просмотр исходного кода

fix:groupkey归类宽泛bug修复

tanjingyu 1 неделя назад
Родитель
Сommit
1ad30db164
1 измененных файлов с 11 добавлено и 7 удалено
  1. 11 7
      app/services/webhook_service.py

+ 11 - 7
app/services/webhook_service.py

@@ -223,6 +223,11 @@ class WebhookService:
         processed_keys: set
     ) -> bool:
         """Get file SHA from Gogs and process a single changed file, plus its paired input if configured."""
+        # Pre-collect paired inputs to help determine grouping logic
+        paired_configs = output_config.get("paired_inputs", [])
+        if "paired_input" in output_config:
+            paired_configs.append(output_config["paired_input"])
+
         # Calculate group_key here so both paired input and output can share it
         directory_depth = output_config.get("directory_depth")
         if directory_depth is not None and directory_depth > 0:
@@ -231,6 +236,11 @@ class WebhookService:
                 group_key = "/".join(parts[:-1][:directory_depth])
             else:
                 group_key = ""
+        elif paired_configs:
+            # If we have paired inputs, use the full file path as a unique group key 
+            # to avoid "cross-talk" where multiple outputs in the same directory 
+            # share all paired inputs from that directory.
+            group_key = file_path
         else:
             group_key = os.path.dirname(file_path)
 
@@ -254,13 +264,7 @@ class WebhookService:
             group_key=group_key,
         )
 
-        # Handle paired_inputs active fetching
-        paired_inputs = output_config.get("paired_inputs", [])
-        # For backward compatibility with the singular config we just added
-        if "paired_input" in output_config:
-            paired_inputs.append(output_config["paired_input"])
-
-        for paired_config in paired_inputs:
+        for paired_config in paired_configs:
             extract_regex = paired_config.get("extract_regex")
             path_template = paired_config.get("path_template")
             if extract_regex and path_template: