diff --git a/.ci/create-changes-html.sh b/.ci/create-changes-html.sh index cce6c45acac..cdae3a49df8 100755 --- a/.ci/create-changes-html.sh +++ b/.ci/create-changes-html.sh @@ -62,10 +62,12 @@ for block in diff_blocks: match = re.search(r'^diff --git a/(.*) b/\1', block, flags=re.MULTILINE) if match: doc = match.group(1) - path = 'html/' + doc file_path = os.path.join('$DOC_REPOSITORY', doc) - with open(file_path, 'r') as file: - content = file.readlines() + try: + with open(file_path, 'r') as file: + content = file.readlines() + except FileNotFoundError: + content = [] count = 0 for line in block.splitlines(): if line.startswith('@@ -'): @@ -77,8 +79,10 @@ for block in diff_blocks: count += 1 content[i] = f'' + content[i] break - with open(file_path, 'w') as file: - file.writelines(content) + if content: + with open(file_path, 'w') as file: + file.writelines(content) + path = 'html/' + doc hunks = ' '.join(f'#{i + 1}' for i in range(count)) out_blocks.append(f'
{doc} ' + hunks + '
' + '\n'