浏览代码

Remove 'I-prioritize' label when an issue is closed (#638)

Elinvynia 4 年之前
父节点
当前提交
76f6417772
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      src/handlers/autolabel.rs

+ 8 - 0
src/handlers/autolabel.rs

@@ -60,6 +60,14 @@ impl Handler for AutolabelHandler {
                     }
                 }
             }
+            if e.action == github::IssuesAction::Closed {
+                let labels = event.issue().unwrap().labels();
+                if let Some(x) = labels.iter().position(|x| x.name == "I-prioritize") {
+                    let mut labels_excluded = labels.to_vec();
+                    labels_excluded.remove(x);
+                    return Ok(Some(AutolabelInput { labels: labels_excluded }));
+                }
+            }
         }
         Ok(None)
     }