Skip to content

Commit

Permalink
fix parse to test integration
Browse files Browse the repository at this point in the history
  • Loading branch information
joulei committed Oct 27, 2022
1 parent 75edb24 commit 72f682a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
9 changes: 6 additions & 3 deletions parser/src/command/decision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -22,11 +22,14 @@ pub struct DecisionCommand {
}

impl DecisionCommand {
pub fn parse<'a>(_input: &mut Tokenizer<'a>) -> Result<Option<Self>, Error<'a>> {
pub fn parse<'a>(input: &mut Tokenizer<'a>) -> Result<Option<Self>, Error<'a>> {
if let Some(Token::Word("merge")) = input.peek_token()? {
Ok(Some(Self {
resolution: Resolution::Merge,
reversibility: Reversibility::Reversible
}))
})) } else {
Ok(None)
}
}
}

Expand Down
19 changes: 16 additions & 3 deletions src/handlers/decision.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use anyhow::Context as Ctx;
use parser::command::decision::{DecisionCommand, ParseError};
use crate::{
config::DecisionConfig,
Expand Down Expand Up @@ -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 {
Expand All @@ -73,7 +72,7 @@ pub(super) async fn handle_command(
// status_history,
// ..state
// })
Ok()
Ok();
},
None => {
match resolution {
Expand All @@ -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();
}
}
}
Expand Down

0 comments on commit 72f682a

Please sign in to comment.