From eee74d78834370d4476f35d2ee360be47001dff5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9my=20Coutable?= <remy@rymai.me>
Date: Wed, 14 Feb 2024 15:51:46 +0100
Subject: [PATCH] Allow to set changelog_type for Houskeeper::Change
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Rémy Coutable <remy@rymai.me>
---
 .../lib/gitlab/housekeeper/change.rb          |  5 +++--
 .../spec/gitlab/housekeeper/change_spec.rb    | 22 +++++++++++++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/gems/gitlab-housekeeper/lib/gitlab/housekeeper/change.rb b/gems/gitlab-housekeeper/lib/gitlab/housekeeper/change.rb
index 4ca277e7d7c79..7c40959e5d1c4 100644
--- a/gems/gitlab-housekeeper/lib/gitlab/housekeeper/change.rb
+++ b/gems/gitlab-housekeeper/lib/gitlab/housekeeper/change.rb
@@ -9,7 +9,8 @@ class Change
         :changed_files,
         :labels,
         :reviewers,
-        :keep_class
+        :keep_class,
+        :changelog_type
 
       def initialize
         @labels = []
@@ -35,7 +36,7 @@ def commit_message
 
         #{mr_description}
 
-        Changelog: other
+        Changelog: #{changelog_type || 'other'}
         MARKDOWN
       end
 
diff --git a/gems/gitlab-housekeeper/spec/gitlab/housekeeper/change_spec.rb b/gems/gitlab-housekeeper/spec/gitlab/housekeeper/change_spec.rb
index d213e89878d22..10e7e61400b92 100644
--- a/gems/gitlab-housekeeper/spec/gitlab/housekeeper/change_spec.rb
+++ b/gems/gitlab-housekeeper/spec/gitlab/housekeeper/change_spec.rb
@@ -57,6 +57,28 @@
         MARKDOWN
       )
     end
+
+    context 'when setting a "changelog_type"' do
+      before do
+        change.changelog_type = 'removed'
+      end
+
+      it 'incudes "Changelog: removed"' do
+        expect(change.commit_message).to eq(
+          <<~MARKDOWN
+          The title
+
+          The description
+
+          This change was generated by
+          [gitlab-housekeeper](https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-housekeeper)
+
+
+          Changelog: removed
+          MARKDOWN
+        )
+      end
+    end
   end
 
   describe '#valid?' do
-- 
GitLab