Validate React Admin Changelog Files (#34520)

This maps the changelog command of the React Admin in order to ensure that they're validated and able to be added.
This commit is contained in:
Christopher Allford 2022-09-05 13:02:00 -07:00 committed by GitHub
parent 59ee9418e7
commit 6457348a97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 0 deletions

View File

@ -9,6 +9,7 @@
"url": "https://github.com:woocommerce/woocommerce.git"
},
"scripts": {
"changelog": "pnpm run changelog --filter=woocommerce --",
"turbo:build": "pnpm run clean && cross-env NODE_ENV=production WC_ADMIN_PHASE=core webpack",
"turbo:test": "pnpm run test:client",
"analyze": "cross-env NODE_ENV=production ANALYZE=true webpack",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
This change only impacts the validation of changelog files.

View File

@ -128,6 +128,11 @@ foreach ( $composer_projects as $project_path ) {
$changelogger_projects[ $project_path ] = $data;
}
// Support centralizing the changelogs for multiple components and validating them together.
$project_component_map = array(
'plugins/woocommerce-admin' => 'plugins/woocommerce',
);
// Process the diff.
debug( 'Checking diff from %s...%s.', $base, $head );
$pipes = null;
@ -155,6 +160,17 @@ while ( ( $line = fgets( $pipes[1] ) ) ) {
}
}
// Also try to match to project components.
if ( false === $project_match ) {
foreach ( $project_component_map as $path => $project ) {
if ( substr( $line, 0, strlen( $path ) + 1 ) === $path . '/' ) {
debug( 'Mapping %s to project %s.', $line, $project );
$project_match = $project;
break;
}
}
}
if ( false === $project_match ) {
debug( 'Ignoring non-project file %s.', $line );
continue;