diff --git a/parser/src/command/decision.rs b/parser/src/command/decision.rs index 31e22c97..c6a6df18 100644 --- a/parser/src/command/decision.rs +++ b/parser/src/command/decision.rs @@ -8,7 +8,7 @@ //! Command: `@bot merge`, `@bot hold`, `@bot restart`, `@bot dissent`, `@bot stabilize` or `@bot close`. //! ``` -use crate::token::{Tokenizer}; +use crate::token::{Token, Tokenizer}; use crate::error::Error; use serde::{Deserialize, Serialize}; use postgres_types::{FromSql, ToSql}; @@ -22,11 +22,14 @@ pub struct DecisionCommand { } impl DecisionCommand { - pub fn parse<'a>(_input: &mut Tokenizer<'a>) -> Result, Error<'a>> { + pub fn parse<'a>(input: &mut Tokenizer<'a>) -> Result, Error<'a>> { + if let Some(Token::Word("merge")) = input.peek_token()? { Ok(Some(Self { resolution: Resolution::Merge, reversibility: Reversibility::Reversible - })) + })) } else { + Ok(None) + } } } diff --git a/src/handlers/decision.rs b/src/handlers/decision.rs index 6dfa27c7..3644c3cf 100644 --- a/src/handlers/decision.rs +++ b/src/handlers/decision.rs @@ -1,3 +1,4 @@ +use anyhow::Context as Ctx; use parser::command::decision::{DecisionCommand, ParseError}; use crate::{ config::DecisionConfig, @@ -46,8 +47,6 @@ pub(super) async fn handle_command( return Ok(()); } - // return Ok(()); - match get_decision_state(issue.id) { Some(state) => { // let name = match disposition { @@ -73,7 +72,7 @@ pub(super) async fn handle_command( // status_history, // ..state // }) - Ok() + Ok(); }, None => { match resolution { @@ -98,6 +97,20 @@ pub(super) async fn handle_command( reversibility, resolution, ); + + let comment = format!( + "Wow, it looks like you want to merge this, {}.", event.user().login + ); + + let comment = format!( + "| Team member | State |\n|-------------|-------|\n| julmontesdeoca | merge |\n| mcass19 | |"); + + issue + .post_comment(&ctx.github, &comment) + .await + .context("merge vote comment")?; + + Ok(); } } }