From a12096c4ee1389a58c1d868b4770b7c03b0688a7 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 30 Apr 2020 21:32:27 +0200 Subject: [PATCH] Only add a comment of PR is eligible This maybe fixes https://github.com/voxpupuli/vox-pupuli-tasks/issues/159 --- app/models/pull_request.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/pull_request.rb b/app/models/pull_request.rb index ce75359d..013650fa 100644 --- a/app/models/pull_request.rb +++ b/app/models/pull_request.rb @@ -96,11 +96,16 @@ def ensure_label_is_detached(label) ## # Add a comment with the given text def add_comment(text) + # TODO: why can request be nil and what is request req = begin request rescue StandardError nil end + # Only attach a comment if eligible_for_comment is true (The first iteration + # after the mergeable state changed to false) + return unless eligible_for_comment + Raven.capture_message('Added a comment', extra: { text: text, repo: repository.github_url,