瀏覽代碼

Avoid errors about major-change feature use on rename

The previous implementation would detect any rename as being related to major
changes which is not generally the case.
Mark Rousskov 4 年之前
父節點
當前提交
b5a08b44a1
共有 1 個文件被更改,包括 15 次插入2 次删除
  1. 15 2
      src/handlers/major_change.rs

+ 15 - 2
src/handlers/major_change.rs

@@ -27,10 +27,23 @@ pub(super) fn parse_input(
                     title: previous_title.from.clone(),
                     repository: event.issue.repository().clone(),
                 };
-                return Ok(Some(Invocation::Rename { prev_issue }));
+                if event
+                    .issue
+                    .labels()
+                    .iter()
+                    .any(|l| l.name == "major-change")
+                {
+                    return Ok(Some(Invocation::Rename { prev_issue }));
+                } else {
+                    // Ignore renamed issues without major-change label
+                    // to avoid warning about the major-change feature not being
+                    // enabled.
+                    return Ok(None);
+                }
             }
         } else {
-            return Err(format!("no changes property in edited event"));
+            log::warn!("Did not note changes in edited issue?");
+            return Ok(None);
         }
     }