From da089143810f2983e86d692f6ce60f8366a22600 Mon Sep 17 00:00:00 2001 From: alinpahontu2912 Date: Tue, 17 Feb 2026 11:47:25 +0100 Subject: [PATCH] fix: correct YAML indentation in update-releasenotes workflow The Python heredoc content was at column 1, which broke out of the YAML block scalar for the 'run' key. Indented the heredoc body to align with the run block so YAML parses it correctly. The block scalar automatically strips the common indentation, so Python receives the code without extra leading spaces. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/update-releasenotes.yml | 116 +++++++++++----------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/.github/workflows/update-releasenotes.yml b/.github/workflows/update-releasenotes.yml index 64b638d1f..3760e8ac3 100644 --- a/.github/workflows/update-releasenotes.yml +++ b/.github/workflows/update-releasenotes.yml @@ -64,64 +64,64 @@ jobs: VERSION_HEADER="# NuGet Version ${CURRENT_VERSION}" python3 - <<'PYEOF' -import os, sys - -file_path = os.environ['FILE'] -ver_header = os.environ['VERSION_HEADER'] -section = os.environ['SECTION'] -pr_number = os.environ['PR_NUMBER'] -pr_title = os.environ['PR_TITLE'] -entry = f"#{pr_number} {pr_title}
" - -with open(file_path, 'r') as f: - content = f.read() - lines = content.splitlines(keepends=True) - -# Find the version block and insert the entry -result = [] -in_version_block = False -section_found = False -inserted = False - -for i, line in enumerate(lines): - stripped = line.rstrip('\n') - - if stripped == ver_header: - in_version_block = True - result.append(line) - continue - - if in_version_block and stripped.startswith('# NuGet Version ') and stripped != ver_header: - # Reached next version block without finding/creating section - if not inserted: - result.append('\n' + section + ':\n\n' + entry + '\n\n') - inserted = True - in_version_block = False - result.append(line) - continue - - if in_version_block and not inserted and stripped == section + ':': - section_found = True - result.append(line) - continue - - if section_found and not inserted: - # Insert after the blank line following the section heading - if stripped == '': - result.append(line) - result.append(entry + '\n') - inserted = True - continue - - result.append(line) - -# If we reached EOF still inside the version block -if in_version_block and not inserted: - result.append('\n' + section + ':\n\n' + entry + '\n') - -with open(file_path, 'w') as f: - f.writelines(result) -PYEOF + import os, sys + + file_path = os.environ['FILE'] + ver_header = os.environ['VERSION_HEADER'] + section = os.environ['SECTION'] + pr_number = os.environ['PR_NUMBER'] + pr_title = os.environ['PR_TITLE'] + entry = f"#{pr_number} {pr_title}
" + + with open(file_path, 'r') as f: + content = f.read() + lines = content.splitlines(keepends=True) + + # Find the version block and insert the entry + result = [] + in_version_block = False + section_found = False + inserted = False + + for i, line in enumerate(lines): + stripped = line.rstrip('\n') + + if stripped == ver_header: + in_version_block = True + result.append(line) + continue + + if in_version_block and stripped.startswith('# NuGet Version ') and stripped != ver_header: + # Reached next version block without finding/creating section + if not inserted: + result.append('\n' + section + ':\n\n' + entry + '\n\n') + inserted = True + in_version_block = False + result.append(line) + continue + + if in_version_block and not inserted and stripped == section + ':': + section_found = True + result.append(line) + continue + + if section_found and not inserted: + # Insert after the blank line following the section heading + if stripped == '': + result.append(line) + result.append(entry + '\n') + inserted = True + continue + + result.append(line) + + # If we reached EOF still inside the version block + if in_version_block and not inserted: + result.append('\n' + section + ':\n\n' + entry + '\n') + + with open(file_path, 'w') as f: + f.writelines(result) + PYEOF - name: Commit and push shell: bash