webhook-gateway 2.17.2

A service to ingress github event
Documentation
use crate::reg;
pub static FAIL_IMAGE_URL: &str = "![failed](https://internal.corpname.com/static/developer-server/failed-16px.png 'failed')";
pub static DOC_URL: &str = "[AU for a PR](doc_url)";

static KEYWORDS: [&str; 1] = ["LXT"];

pub fn contain_keywords(s: &str) -> bool {
    contains_webhook_gateway_patten(s) || contains_time_spent_pattern(s)
}

pub fn contains_time_spent_pattern(s: &str) -> bool {
    let pat = reg!(r"(T|t)U\s(?P<t>(\d{1})|(\d\.\d{1,3}))!");
    pat.captures(s).is_some()
    
}

pub fn contains_webhook_gateway_patten(s: &str) -> bool {
    KEYWORDS.iter().any(|k| s.contains(k))
}

#[cfg(test)]
mod test
{
    use super::*;
    #[test]
    fn time_spent() {
        let s = "tU 3!";
        assert_eq!(contains_time_spent_pattern(s), true);
        let s = "TU 0.4!";
        assert_eq!(contains_time_spent_pattern(s), true);
    }
}