Skip to content

Commit

Permalink
Merge pull request #149 from mikeee/bot-fix
Browse files Browse the repository at this point in the history
fix: bot no longer returns an error for non-assign comments and also …
  • Loading branch information
mikeee authored Mar 20, 2024
2 parents 8a28b12 + ac2e6e9 commit 372522a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/dapr-bot-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
- ".github/workflows/dapr-bot-test.yml"
- ".github/workflows/dapr-bot/*"
pull_request:
branches:
- main
paths: # Explicitly declare which paths (could potentially be combined into dapr-bot*
- ".github/workflows/dapr-bot.yml"
- ".github/workflows/dapr-bot-test.yml"
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/dapr-bot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ async fn main() -> octocrab::Result<()> {

if github_event_name != ISSUE_COMMENT_EVENT_NAME {
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
Expand All @@ -52,7 +53,7 @@ async fn main() -> octocrab::Result<()> {
// check the issue body
if !event.clone().comment.body.unwrap().starts_with("/assign") {
println!("Event does not start with /assign");
exit(exitcode::TEMPFAIL);
exit(exitcode::OK);
}

let assignee: String = event.comment.user.login;
Expand All @@ -68,6 +69,7 @@ async fn main() -> octocrab::Result<()> {
.await
{
Ok(_) => {
println!("Assigned issue to user successfully");
match github_client
.create_comment(
OWNER,
Expand Down

0 comments on commit 372522a

Please sign in to comment.