@@ -66,11 +66,13 @@ def update_image_tag(self):
66
66
end_index = yaml_content .find (' ' , start_index )
67
67
if end_index == - 1 :
68
68
end_index = len (yaml_content )
69
- tag_to_replace = yaml_content [start_index + len (pattern ):end_index ]
69
+ tag_to_replace = yaml_content [start_index + len (pattern ):end_index - 1 ]
70
70
updated_yaml_content = yaml_content .replace (
71
71
f'{ self .docker_repo } :{ tag_to_replace } ' ,
72
72
f'{ self .docker_repo } :{ self .new_image_tag } '
73
73
)
74
+ else :
75
+ raise ValueError ("No image tag found in the YAML content" )
74
76
75
77
# Write the updated content back to the file
76
78
with open (self .yaml_file_path , 'w' ) as f :
@@ -138,11 +140,9 @@ def create_pull_request(self, pr_title, pr_body):
138
140
self .commit_and_push_changes ()
139
141
if self .check_pull_request_exists ():
140
142
return
141
- # Create a pull request
142
- subprocess .run (['gh' , 'pr' , 'create' , '--base' , 'main' , '--head' , self .branch_name , '--title' , pr_title , '--body' , pr_body ])
143
-
144
- print (f"Pull request created for branch: { self .branch_name } " )
145
-
143
+ else :
144
+ subprocess .run (['gh' , 'pr' , 'create' , '--base' , 'main' , '--head' , self .branch_name , '--title' , pr_title , '--body' , pr_body ])
145
+ print (f"Pull request created for branch: { self .branch_name } " )
146
146
except Exception as e :
147
147
print (f"Error creating pull request: { e } " )
148
148
0 commit comments