Skip to content

comment_on_summary doesn't work for non-issue triage policies

Summary

Using the comment_on_summary action for triage policies for resources different than issues doesn't work.

Steps to reproduce

  1. Create a triage policy for merge_requests (or any other non-issue resource)
  2. Add summarize and comment_on_summary to the policy.
  3. Make sure at least one MR matches the conditions
  4. Run the policy

Another way to reproduce is to copy/modify comment_on_summary_spec.rb to account for testing for non-issue triage policies.

What is the current bug behavior?

No comment is posted to the summary issue.

What is the expected correct behavior?

Comments should be posted to the summary issue.

Relevant logs and/or screenshots

gitlab-triage doesn't report any errors.

Possible fixes

This fixes the issue for me:

diff --git a/lib/gitlab/triage/action/comment_on_summary.rb b/lib/gitlab/triage/action/comment_on_summary.rb
index d986ffd..3b57311 100644
--- a/lib/gitlab/triage/action/comment_on_summary.rb
+++ b/lib/gitlab/triage/action/comment_on_summary.rb
@@ -57,7 +57,7 @@ module Gitlab
           post_url = UrlBuilders::UrlBuilder.new(
             network_options: network.options,
             source_id: summary['project_id'],
-            resource_type: policy.type,
+            resource_type: 'issues',
             resource_id: summary['iid'],
             sub_resource_type: sub_resource_type
           ).build