@@ -61,10 +61,12 @@ def update_component_version(current_version, new_version)
6161 GithubClient . octokit . branch ( Project ::Reticulum . github_path , Project ::Reticulum . default_branch ) . commit . sha
6262 )
6363
64+ update_title = "Update #{ component . component_name } version to #{ present_sha ( new_version ) } "
65+
6466 GithubClient . octokit . update_contents (
6567 Project ::Reticulum . github_path ,
6668 version_file ,
67- "Update #{ component . component_name } version to #{ present_sha ( new_version ) } " ,
69+ update_title ,
6870 version_file_content . sha ,
6971 new_version ,
7072 branch : update_branch
@@ -76,7 +78,7 @@ def update_component_version(current_version, new_version)
7678 Project ::Reticulum . github_path ,
7779 Project ::Reticulum . default_branch ,
7880 update_branch ,
79- "Update #{ component . component_name } version to #{ present_sha ( new_version ) } " ,
81+ update_title ,
8082 <<~DESCRIPTION
8183 Update #{ component . component_name } to #{ new_version_link } as part of managed versioning
8284
@@ -85,7 +87,16 @@ def update_component_version(current_version, new_version)
8587 )
8688 logger . info ( 'Created pull request' , pull_request_url : pr . html_url )
8789
88- Pyxis ::Services ::AutoMergeService . new ( Project ::Reticulum , pr ) . execute
90+ if version_update_loop? ( update_title )
91+ GithubClient . octokit . add_comment (
92+ Project ::Reticulum . github_path ,
93+ pr . number ,
94+ '@code0-tech/delivery This component had already been updated to this version in the past. ' \
95+ 'Please check why this component is getting updated to this version again.'
96+ )
97+ else
98+ Pyxis ::Services ::AutoMergeService . new ( Project ::Reticulum , pr ) . execute
99+ end
89100 end
90101
91102 def update_branch_exists?
@@ -124,6 +135,16 @@ def filter_for_passing_checks(commits)
124135 filtered_commits
125136 end
126137
138+ def version_update_loop? ( update_title )
139+ commits = GithubClient . without_auto_pagination ( GithubClient . octokit ) do |octokit |
140+ octokit . list_commits (
141+ Project ::Reticulum . github_path ,
142+ path : version_file
143+ )
144+ end
145+ commits . reverse . any? { |commit | commit . commit . message == update_title }
146+ end
147+
127148 def present_sha ( sha )
128149 Presenter ::CommitSha . new ( sha ) . as_short
129150 end
0 commit comments