forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PR check for proposed API changes
Fixes #20939 Add a PR check for proposed API changes without VS Code engine update. * Modify `package.json` to add a new script entry `check-proposed-api`. * Modify `.github/workflows/pr-file-check.yml` to add a new step to run the `check-proposed-api` script. * Add `src/check-proposed-api.js` to check for changes in `enabledApiProposals` and `vscode` engine version, and fail if `enabledApiProposals` is modified but `vscode` engine version is not updated. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/microsoft/vscode-python/issues/20939?shareId=XXXX-XXXX-XXXX-XXXX).
- Loading branch information
1 parent
32512b1
commit 4a00aa6
Showing
3 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const fs = require('fs'); | ||
|
||
const packageJsonPath = './package.json'; | ||
|
||
function checkProposedApiChanges() { | ||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); | ||
|
||
const enabledApiProposals = packageJson.enabledApiProposals; | ||
Check failure on line 8 in src/check-proposed-api.js GitHub Actions / Lint
|
||
const vscodeEngineVersion = packageJson.engines.vscode; | ||
|
||
const originalPackageJson = JSON.parse(fs.readFileSync(packageJsonPath + '.original', 'utf8')); | ||
Check failure on line 11 in src/check-proposed-api.js GitHub Actions / Lint
|
||
const originalEnabledApiProposals = originalPackageJson.enabledApiProposals; | ||
const originalVscodeEngineVersion = originalPackageJson.engines.vscode; | ||
|
||
if (JSON.stringify(enabledApiProposals) !== JSON.stringify(originalEnabledApiProposals) && | ||
vscodeEngineVersion === originalVscodeEngineVersion) { | ||
console.error('Error: `enabledApiProposals` was modified but `vscode` engine version was not updated.'); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
checkProposedApiChanges(); |