gitlab-triage 1.55.1 → 1.56.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72ed33025703247cca10024af7e8be895ecc03094d5733830b6dcbc73742aae5
4
- data.tar.gz: da8fc6fc4932bd8038bf69947533cdcfc5bd0efb75d07c3e25c262d23e822411
3
+ metadata.gz: 9420b956227ae89432c05b78279b5c8267bf98e721c4feb2cde5fee21a7d611a
4
+ data.tar.gz: ffde105e64820dca1e873e4c368bbe65d4039080aba864e114e67e7c6d3efaa3
5
5
  SHA512:
6
- metadata.gz: 0703eb40a6bd259c8931eb2ec71bdd3492e5bee59d0644737b1919b38c414776f547b06344bed54b9dc6d6825a5fca7bc06ea5e98de2cbcd8d0a1adccf936707
7
- data.tar.gz: 59768f9c0f1be9f286af3a0e357a3a2be44db55e32b5df7e97381a273a4f397432574c2f65f09854a45eb7e7060ea9fcbad202ee12e076938278dea68df5eda6
6
+ metadata.gz: 4475319216eee8897599eef75260c58e3d677043d3a8b86cbe1ef44b6146faafb967786d3004731879b8a9c4996a21620a50956196f978aa94c704f9e2c2ef96
7
+ data.tar.gz: 42b71bf2233e9daeeec8834b2bb3d651f620f758f83cb3e4e17701208aa40fbf55473532d5eff574dde327afc4c3d97029c370ee5c34198d22bf784a51af932d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-triage (1.55.1)
4
+ gitlab-triage (1.56.1)
5
5
  activesupport (>= 5.1)
6
6
  globalid (~> 1.0, >= 1.0.1)
7
7
  graphql (< 2.1.0)
data/README.md CHANGED
@@ -1930,6 +1930,17 @@ resource_rules:
1930
1930
  #{'/label ~P3' unless has_priority_label?}
1931
1931
  ```
1932
1932
 
1933
+ A plugin can also set a filter that receives every `comment` and
1934
+ `comment_on_summary` body before it is posted or printed in dry-run mode,
1935
+ and returns the body to post. An empty or `nil` result posts nothing. The
1936
+ filter is process-wide and does not apply to `summarize`, `issue`, or
1937
+ `work_item` descriptions. This example drops every line that starts with a
1938
+ slash, so adapt it to your needs:
1939
+
1940
+ ```ruby
1941
+ Gitlab::Triage::Action::Comment.filter = ->(body) { body.gsub(%r{^/\w+.*$\n?}, '') }
1942
+ ```
1943
+
1933
1944
  ### API Response Caching (`--cache-dir`)
1934
1945
 
1935
1946
  In large CI pipelines with many concurrent triage jobs, each job independently fetches the same paginated API responses (e.g., group members). This results in many redundant API calls.
@@ -9,6 +9,14 @@ module Gitlab
9
9
  module Triage
10
10
  module Action
11
11
  class Comment < Base
12
+ class << self
13
+ attr_accessor :filter
14
+
15
+ def apply_filter(text)
16
+ (filter ? filter.call(text) : text).to_s.strip
17
+ end
18
+ end
19
+
12
20
  class Dry < Comment
13
21
  def act
14
22
  puts "The following comments would be posted for the rule **#{policy.name}**:\n\n"
@@ -30,7 +38,7 @@ module Gitlab
30
38
  end
31
39
 
32
40
  policy.resources.each do |resource|
33
- comment = build_comment(resource).strip
41
+ comment = Comment.apply_filter(build_comment(resource))
34
42
 
35
43
  perform(resource, comment) unless comment.empty?
36
44
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'base'
4
+ require_relative 'comment'
4
5
  require_relative '../command_builders/text_content_builder'
5
6
 
6
7
  module Gitlab
@@ -30,7 +31,7 @@ module Gitlab
30
31
 
31
32
  def act
32
33
  policy.resources.each do |resource|
33
- comment = build_comment(resource).strip
34
+ comment = Comment.apply_filter(build_comment(resource))
34
35
 
35
36
  perform(comment) unless comment.empty?
36
37
  end
@@ -52,7 +52,9 @@ module Gitlab
52
52
  when Array
53
53
  resources.concat(results)
54
54
  when Hash
55
- if results['message']&.match?(/404 Group|Project Not Found/)
55
+ message = results['message']
56
+
57
+ if message.is_a?(Hash) || message.is_a?(Array) || message.to_s.match?(/404 Group|Project Not Found/)
56
58
  raise_unexpected_response(results)
57
59
  else
58
60
  resources << results
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module Triage
5
- VERSION = '1.55.1'
5
+ VERSION = '1.56.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-triage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.55.1
4
+ version: 1.56.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-30 00:00:00.000000000 Z
11
+ date: 2026-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport