-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[EngSys] add versioning pull request validation #36022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…on tool - Added detailed README with usage examples and integration instructions - Formatted code with prettier - Tool validates packages with src/ changes have version bumps - Uses npm registry to check last published stable/beta versions - Exits with code 1 if violations found for CI/CD integration
There was a problem hiding this 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 introduces a new versioning validation tool to ensure packages with source code changes in their src/ directories have appropriate version bumps in pull requests. The tool helps maintain proper versioning by automating validation in CI/CD pipelines.
Key changes:
- Adds a new CLI tool that compares current package versions against published versions to detect missing version bumps
- Integrates the validation into the Azure Pipelines analyze step to run automatically on pull requests
- Removes unused dependency from package.json to clean up dependencies
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| eng/tools/versioning/validatePullRequestVersion.md | Complete documentation for the new versioning validation tool |
| eng/tools/versioning/validatePullRequestVersion.js | Main implementation of the version validation CLI tool |
| eng/tools/versioning/package.json | Removes unused yargs-parser dependency |
| eng/pipelines/templates/steps/analyze.yml | Integrates versioning validation into CI pipeline |
Files not reviewed (1)
- eng/tools/versioning/package-lock.json: Language not supported
| }, | ||
| "base-ref": { | ||
| type: "string", | ||
| default: "HEAD^1", |
Copilot
AI
Sep 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default base reference 'HEAD^1' conflicts with the documentation which shows 'origin/main' as the default. This inconsistency could cause confusion and unexpected behavior. Consider updating the default to match the documented behavior or updating the documentation to reflect the actual default.
| default: "HEAD^1", | |
| default: "origin/main", |
| const packageSrcPattern = `${packagePath}/src/`; | ||
| return normalizedFile.startsWith(packageSrcPattern); |
Copilot
AI
Sep 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The string comparison for detecting src/ changes could match unintended paths. For example, a file 'sdk/package/src-backup/file.js' would match the pattern 'sdk/package/src/'. Consider using a more precise pattern that ensures the src directory is followed by a path separator or end of string.
| const packageSrcPattern = `${packagePath}/src/`; | |
| return normalizedFile.startsWith(packageSrcPattern); | |
| // Match only files directly under the src directory, not src-backup or similar | |
| const packageSrcRegex = new RegExp(`^${packagePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/src(?:/|$)`); | |
| return packageSrcRegex.test(normalizedFile); |
| displayName: "Install versioning tool dependencies" | ||
| - script: | | ||
| node validatePullRequestVersion.js |
Copilot
AI
Sep 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The versioning validation runs without any command-line arguments, relying entirely on defaults. Since this is in a CI environment, it would be more explicit and maintainable to specify the base reference (e.g., '--base-ref origin/main') to ensure consistent behavior regardless of local git state.
| node validatePullRequestVersion.js | |
| node validatePullRequestVersion.js --base-ref origin/main |
that reports errors if changes are made to a package's
src/directory but thepackage version has not been incremented.
We want to ensure that product changes happen in a new version that is different
from the last published version. This PR adds a check that ensure that we bump
versions when making source changes.