Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recursive bot commands #548

Merged
merged 3 commits into from
Jun 7, 2021

Conversation

NickLaMuro
Copy link
Member

Removes bot thinking it is calling itself when making a comment where it's username could be used when adding a label.

See the following for an example:

ManageIQ/manageiq-providers-kubernetes#124 (comment)

@Fryguy
Copy link
Member

Fryguy commented Feb 22, 2021

Oh i see - this is label specific...I'm concerned this could happen with any command where the bot replies

@miq-bot miq-bot added the wip label Feb 22, 2021
Adds a method for fetching the `bot_name` from the `GithubService`
module, and standardizes it throughout the codebase.
@NickLaMuro NickLaMuro force-pushed the fix-bot-recursion-with-add-label branch from 99bfe8a to c68203d Compare February 22, 2021 22:26
@NickLaMuro NickLaMuro changed the title [WIP] [POC] Fix recursive bot commands Fix recursive bot commands Feb 22, 2021
When the bot is issuing command, ignore it so it doesn't try responding
to itself.
As an example, when moving an issue, the description could contain the
following:

  "@miq-bot add-label providers/containers, ..."

Said label might not exist, so the following could previously be
generated:

  "@miq-bot Cannot apply the following label..."

To avoid this with this command specifically, don't include the username
in the error message if the bot is the one including it.
@NickLaMuro NickLaMuro force-pushed the fix-bot-recursion-with-add-label branch from c68203d to fb80cc6 Compare February 22, 2021 22:28
@NickLaMuro
Copy link
Member Author

NickLaMuro commented Feb 22, 2021

First commit trues up our usage of bot_command, and makes it a method on GithubService. The rest of the PR is fixing the two spots previously identified... now with infinitely more tests than before (on this PR)!

@miq-bot miq-bot removed the wip label Feb 22, 2021
@miq-bot
Copy link
Member

miq-bot commented Feb 22, 2021

Checked commits NickLaMuro/miq_bot@e76661e~...fb80cc6 with ruby 2.6.3, rubocop 0.82.0, haml-lint 0.35.0, and yamllint
6 files checked, 2 offenses detected

lib/github_service/commands/add_label.rb

@bdunne bdunne merged commit 436d43e into ManageIQ:master Jun 7, 2021
@bdunne bdunne self-assigned this Jun 7, 2021
@bdunne bdunne added the bug label Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants