mirror of https://github.com/dapr/rust-sdk.git
Merge pull request #149 from mikeee/bot-fix
fix: bot no longer returns an error for non-assign comments and also …
This commit is contained in:
commit
372522a775
|
@ -7,8 +7,6 @@ on:
|
||||||
- ".github/workflows/dapr-bot-test.yml"
|
- ".github/workflows/dapr-bot-test.yml"
|
||||||
- ".github/workflows/dapr-bot/*"
|
- ".github/workflows/dapr-bot/*"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths: # Explicitly declare which paths (could potentially be combined into dapr-bot*
|
paths: # Explicitly declare which paths (could potentially be combined into dapr-bot*
|
||||||
- ".github/workflows/dapr-bot.yml"
|
- ".github/workflows/dapr-bot.yml"
|
||||||
- ".github/workflows/dapr-bot-test.yml"
|
- ".github/workflows/dapr-bot-test.yml"
|
||||||
|
|
|
@ -43,7 +43,8 @@ async fn main() -> octocrab::Result<()> {
|
||||||
|
|
||||||
if github_event_name != ISSUE_COMMENT_EVENT_NAME {
|
if github_event_name != ISSUE_COMMENT_EVENT_NAME {
|
||||||
println!("Event is not an issue_comment, the app will now exit.");
|
println!("Event is not an issue_comment, the app will now exit.");
|
||||||
exit(exitcode::TEMPFAIL);
|
exit(exitcode::TEMPFAIL); // This failure is because the bot is not
|
||||||
|
// designed to process anything other than an issue_comment
|
||||||
}
|
}
|
||||||
|
|
||||||
// deserialize event payload
|
// deserialize event payload
|
||||||
|
@ -52,7 +53,7 @@ async fn main() -> octocrab::Result<()> {
|
||||||
// check the issue body
|
// check the issue body
|
||||||
if !event.clone().comment.body.unwrap().starts_with("/assign") {
|
if !event.clone().comment.body.unwrap().starts_with("/assign") {
|
||||||
println!("Event does not start with /assign");
|
println!("Event does not start with /assign");
|
||||||
exit(exitcode::TEMPFAIL);
|
exit(exitcode::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
let assignee: String = event.comment.user.login;
|
let assignee: String = event.comment.user.login;
|
||||||
|
@ -68,6 +69,7 @@ async fn main() -> octocrab::Result<()> {
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
|
println!("Assigned issue to user successfully");
|
||||||
match github_client
|
match github_client
|
||||||
.create_comment(
|
.create_comment(
|
||||||
OWNER,
|
OWNER,
|
||||||
|
|
Loading…
Reference in New Issue