Skip to content

Conversation

@haolingdong-msft
Copy link
Member

@haolingdong-msft haolingdong-msft commented Nov 25, 2025

Description

Fix Azure/azure-sdk-tools#12382

Follow up on this PR: #47079 (comment)
Add UT to test the inner loop, update changelog script.

Code changes:

  1. Refactor: Put the helper functions in Automation-Sdk-UpdateChangelog.ps1 into module ChangelogAutomationHelper.psm1 for better code reuse and for better testing, by looking at Pester's document. Not a powershell expert. Please let me know if you have better suggestions. Thank you! @raych1 @weshaggard
  2. Add a unit test file to test each functions
  3. Add a pipeline by referring to the existing dotnet pipeline

Test result:
image

--- Update at 2025.11.26------
Removed module file and add helper function directly in commit ee91641

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@haolingdong-msft haolingdong-msft marked this pull request as ready for review November 25, 2025 08:34
Copilot AI review requested due to automatic review settings November 25, 2025 08:34
Copilot finished reviewing on behalf of haolingdong-msft November 25, 2025 08:38
Copy link
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 refactors the changelog automation script by extracting helper functions into a reusable PowerShell module (ChangelogAutomationHelper.psm1), adds comprehensive unit tests using the Pester framework, and introduces a pipeline to run these tests automatically.

Key changes:

  • Helper functions moved from the main script to a dedicated module for better code organization and testability
  • Unit test suite added covering most functions (Get-MavenArtifactInfo, Get-LatestReleasedStableVersion, Get-BuiltJarPath, New-ChangelogContent, Update-ChangelogFile)
  • Pipeline configuration added to run Pester tests automatically
  • Main script simplified to import and use the module functions

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
eng/scripts/tests/Automation-Sdk-UpdateChangelog.tests.ps1 New unit test file with comprehensive test coverage for changelog automation functions using Pester framework
eng/scripts/modules/ChangelogAutomationHelper.psm1 New PowerShell module containing refactored helper functions with proper documentation and error handling
eng/scripts/Automation-Sdk-UpdateChangelog.ps1 Refactored to import the new module, removing ~480 lines of duplicate function definitions
eng/pipelines/templates/stages/powershell-tests.yml New pipeline configuration to run Pester tests automatically on Windows agents

Copy link
Member

@weshaggard weshaggard left a comment

Choose a reason for hiding this comment

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

I made a suggestion about the pipeline but that can go in a follow-up PR.

- Test changelog updates when source code changes
- Test idempotent behavior (multiple runs produce identical output)
- Validate unreleased section is preserved after updates
- Remove mocks to test actual file update behavior

Resolves: #47373 (comment)
@haolingdong-msft haolingdong-msft merged commit 3daf3e4 into main Nov 28, 2025
11 checks passed
@haolingdong-msft haolingdong-msft deleted the update-changelog-ut branch November 28, 2025 05:57
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.

[Java] Support Changelog Update

6 participants