-
Notifications
You must be signed in to change notification settings - Fork 233
Description
Background
During changelog generation, the tool reads two types of files from a previously released package version:
-
review/*.api.md— used for API diff to detect breaking changes and new features -
CHANGELOG.md— used as the base for the new changelog entry
The primary path is to extract these files from the npm tarball via npm pack ${packageName}@${version}. However, when the files are not found in the tarball (e.g., review/ directory is not in the package's files field), the code falls back to reading them directly from the local git repository using git commands:
// In npmUtils.ts — tryCreateLastestStableNpmViewFromGithub
git --no-pager show ${tag}:${sdkFilePath} // reads CHANGELOG.md from release tag
git --no-pager show ${tag}:${nodeApiFilePath} // reads -node.api.md from release tag
git --no-pager show ${tag}:${standardApiFilePath} // reads .api.md from release tag
// Additional git commands used to validate before calling the above
git tag -l ${tag} // check if release tag exists locally
git ls-tree -d ${tag} ${relativePath} // check if directory exists in tag
Problem
These git commands are not reliable in standard CI pipeline environments:
- CI pipelines typically use shallow clones (--depth=1), meaning release tags from previous versions are not fetched locally
-
git tag -l ${tag}returns empty even when the tag exists remotely → incorrect false → fallback skipped -
git ls-tree -d ${tag} ...fails silently → wrong assumption about package structure -
git --no-pager show ${tag}:...produces empty content → API diff falls back to empty/default → breaking changes or new features suppressed in the generated changelog
Impact
-
Wrong log generates or Wrong version bumps
Case: [AutoPR @azure-arm-containerservice]-generated-from-SDK Generation - JS-5990415 azure-sdk-for-js#37575
in this pr, the first generation(commit) contains the correct changelog and version
but in the next commit, we can see so many info withCommand failedin the generation pipeline: https://dev.azure.com/azure-sdk/internal/internal%20Team/_build/results?buildId=6019383&view=logs&j=83516c17-6666-5250-abde-63983ce72a49&t=00be4b52-4a63-5865-8e02-c61723ad0692&l=2482
which caused the wrong changelog generation -
Failed update UserAgentInfo
Case: [AutoPR @azure-arm-resourcesdeploymentstacks]-generated-from-SDK Generation - JS-5803515 azure-sdk-for-js#37171
in this pr, the first generation(commit) generates UserAgentInfo correctly:
but in the next generation
it can't update the version (PS: 1.0.0-beta.1 is a default value in codegen) after re-generation.
and in the next generation pipeline we can see it read nothing from git tag command, but it could read it in the first generation pipeline
@jeremymeng could we still export ./review and CHANGELOG.md in packed packages for the changelog generation?