@@ -15,14 +15,13 @@ def remove_ansi_escape_codes(text):
15
15
with open (readme_file , "r" ) as f :
16
16
readme_content = f .read ()
17
17
18
- start_comment_tag = "<!-- HELP-COMMAND-OUTPUT:START --> "
19
- stop_comment_tag = "<!-- HELP-COMMAND-OUTPUT:END --> "
18
+ start_comment_tag = "[comment]: # ( HELP-COMMAND-OUTPUT:START) "
19
+ stop_comment_tag = "[comment]: # ( HELP-COMMAND-OUTPUT:END) "
20
20
21
21
comment_tag_pattern = rf"{ start_comment_tag } (.*?){ stop_comment_tag } "
22
22
tag_section_content = re .search (comment_tag_pattern , readme_content , re .DOTALL )
23
23
24
24
if tag_section_content :
25
-
26
25
try :
27
26
help_command_output_new = subprocess .check_output (["brew" , "autoupdate" , "--help" ], text = True )
28
27
except subprocess .CalledProcessError as e :
@@ -32,7 +31,7 @@ def remove_ansi_escape_codes(text):
32
31
help_command_output_current = tag_section_content .group (1 ).strip ()
33
32
help_command_output_new = remove_ansi_escape_codes (help_command_output_new .strip ())
34
33
35
- start_code_pattern = "```shell "
34
+ start_code_pattern = "```help "
36
35
end_code_pattern = "```"
37
36
38
37
# Regex to check if the existing help section is in a shell code block
@@ -41,13 +40,13 @@ def remove_ansi_escape_codes(text):
41
40
42
41
if help_command_output_current != help_command_output_new :
43
42
print ("Content change detected." )
44
- help = f"{ start_comment_tag } \n { start_code_pattern } \n { help_command_output_new } \n { end_code_pattern } \n { stop_comment_tag } "
43
+ help = f"{ start_comment_tag } \n \n { start_code_pattern } \n { help_command_output_new } \n { end_code_pattern } \n \n { stop_comment_tag } "
45
44
readme_content = re .sub (comment_tag_pattern , help , readme_content , flags = re .DOTALL )
46
45
print ("Content updated." )
47
46
48
47
# Set GitHub Actions output variable
49
48
with open (os .environ ['GITHUB_OUTPUT' ], 'a' ) as fh :
50
- print (f 'changed=true' , file = fh )
49
+ print ('changed=true' , file = fh )
51
50
else :
52
51
print ("No change detected. Content remains unchanged." )
53
52
else :
0 commit comments