Skip to content

Commit 72f682a

Browse files
committed
fix parse to test integration
1 parent 75edb24 commit 72f682a

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

parser/src/command/decision.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//! Command: `@bot merge`, `@bot hold`, `@bot restart`, `@bot dissent`, `@bot stabilize` or `@bot close`.
99
//! ```
1010
11-
use crate::token::{Tokenizer};
11+
use crate::token::{Token, Tokenizer};
1212
use crate::error::Error;
1313
use serde::{Deserialize, Serialize};
1414
use postgres_types::{FromSql, ToSql};
@@ -22,11 +22,14 @@ pub struct DecisionCommand {
2222
}
2323

2424
impl DecisionCommand {
25-
pub fn parse<'a>(_input: &mut Tokenizer<'a>) -> Result<Option<Self>, Error<'a>> {
25+
pub fn parse<'a>(input: &mut Tokenizer<'a>) -> Result<Option<Self>, Error<'a>> {
26+
if let Some(Token::Word("merge")) = input.peek_token()? {
2627
Ok(Some(Self {
2728
resolution: Resolution::Merge,
2829
reversibility: Reversibility::Reversible
29-
}))
30+
})) } else {
31+
Ok(None)
32+
}
3033
}
3134
}
3235

src/handlers/decision.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use anyhow::Context as Ctx;
12
use parser::command::decision::{DecisionCommand, ParseError};
23
use crate::{
34
config::DecisionConfig,
@@ -46,8 +47,6 @@ pub(super) async fn handle_command(
4647
return Ok(());
4748
}
4849

49-
// return Ok(());
50-
5150
match get_decision_state(issue.id) {
5251
Some(state) => {
5352
// let name = match disposition {
@@ -73,7 +72,7 @@ pub(super) async fn handle_command(
7372
// status_history,
7473
// ..state
7574
// })
76-
Ok()
75+
Ok();
7776
},
7877
None => {
7978
match resolution {
@@ -98,6 +97,20 @@ pub(super) async fn handle_command(
9897
reversibility,
9998
resolution,
10099
);
100+
101+
let comment = format!(
102+
"Wow, it looks like you want to merge this, {}.", event.user().login
103+
);
104+
105+
let comment = format!(
106+
"| Team member | State |\n|-------------|-------|\n| julmontesdeoca | merge |\n| mcass19 | |");
107+
108+
issue
109+
.post_comment(&ctx.github, &comment)
110+
.await
111+
.context("merge vote comment")?;
112+
113+
Ok();
101114
}
102115
}
103116
}

0 commit comments

Comments
 (0)