Skip to content

Fix CHANGELOG line ending preservation in Prepare Release workflow#687

Merged
YunchuWang merged 2 commits intomainfrom
wangbill/fix-changelog-line-endings
Mar 24, 2026
Merged

Fix CHANGELOG line ending preservation in Prepare Release workflow#687
YunchuWang merged 2 commits intomainfrom
wangbill/fix-changelog-line-endings

Conversation

@YunchuWang
Copy link
Copy Markdown
Member

Summary

What changed?

  • Fixed the Python script in prepare-release.yaml to preserve original line endings (CRLF) when updating CHANGELOG.md.

Why is this change needed?

  • The first run of the Prepare Release workflow (Add Prepare Release GitHub Action for automated release kickoff #686) produced a diff where every line of CHANGELOG.md appeared changed because the Python script on the Linux runner stripped \r (CRLF → LF) when reading/writing the file.
  • The fix uses newline='' in open() calls to preserve original line endings, and auto-detects the EOL style for inserted content.

Issues / work items


Project checklist

  • Release notes are not required for the next release
  • Backport is not required
  • All required tests have been added/updated (unit tests, E2E tests)
    • N/A - CI workflow fix
  • Breaking change? No

AI-assisted code disclosure (required)

Was an AI tool used? (select one)

  • No
  • Yes, AI helped write parts of this PR (e.g., GitHub Copilot)
  • Yes, an AI agent generated most of this PR

If AI was used:

  • Tool(s): GitHub Copilot
  • AI-assisted areas/files: .github/workflows/prepare-release.yaml
  • What you changed after AI output: Reviewed and verified

AI verification (required if AI was used):

  • I understand the code and can explain it
  • I verified referenced APIs/types exist and are correct
  • I reviewed edge cases/failure paths (timeouts, retries, cancellation, exceptions)
  • I reviewed concurrency/async behavior
  • I checked for unintended breaking or behavior changes

Copilot AI review requested due to automatic review settings March 24, 2026 20:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the “Prepare Release” GitHub Actions workflow to avoid rewriting CHANGELOG.md with different line endings when the workflow runs on Linux, preventing noisy diffs during release preparation.

Changes:

  • Read and write CHANGELOG.md using newline='' to preserve existing line endings.
  • Detect the file’s EOL style (CRLF vs LF) and use it when generating the inserted version section.

@YunchuWang YunchuWang merged commit dc7169a into main Mar 24, 2026
7 checks passed
@YunchuWang YunchuWang deleted the wangbill/fix-changelog-line-endings branch March 24, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants