Fix Component Project Changelog Checking (#42794)
This commit is contained in:
parent
a232c32c8e
commit
d0d49b49f5
|
@ -17,6 +17,7 @@
|
|||
},
|
||||
"extra": {
|
||||
"changelogger": {
|
||||
"changes-dir": "../woocommerce/changelog",
|
||||
"formatter": {
|
||||
"filename": "../../tools/changelogger/class-package-formatter.php"
|
||||
},
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,13 +15,12 @@
|
|||
"php": "7.4"
|
||||
},
|
||||
"allow-plugins": {
|
||||
"composer/installers": true,
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true,
|
||||
"automattic/jetpack-autoloader": true
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"changelogger": {
|
||||
"changes-dir": "../woocommerce/changelog",
|
||||
"formatter": {
|
||||
"filename": "../../tools/changelogger/class-package-formatter.php"
|
||||
},
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "7ce541cc88ff7d19723d117c1ac3a59b",
|
||||
"content-hash": "40f1e35cfc32070fda05769f2f481d39",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
Comment: This is only a change to the way changelogs are generated.
|
||||
|
||||
|
|
@ -121,16 +121,21 @@ foreach ( $composer_projects as $project_path ) {
|
|||
continue;
|
||||
}
|
||||
$data = isset( $data['extra']['changelogger'] ) ? $data['extra']['changelogger'] : array();
|
||||
$data += array(
|
||||
'changelog' => $project_path . '/CHANGELOG.md',
|
||||
'changes-dir' => $project_path . '/changelog',
|
||||
);
|
||||
|
||||
if ( ! isset( $data[ 'changelog' ] ) ) {
|
||||
$data['changelog'] = $project_path . '/CHANGELOG.md';
|
||||
}
|
||||
if ( ! isset( $data[ 'changes-dir' ] ) ) {
|
||||
$data['changes-dir'] = $project_path . '/changelog';
|
||||
}
|
||||
|
||||
$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',
|
||||
'plugins/woocommerce-blocks' => 'plugins/woocommerce',
|
||||
);
|
||||
|
||||
// Process the diff.
|
||||
|
@ -160,15 +165,10 @@ 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;
|
||||
}
|
||||
}
|
||||
// Support overriding the project when checking a component.
|
||||
if ( isset( $project_component_map[ $project_match ] ) ) {
|
||||
$project_match = $project_component_map[ $project_match ];
|
||||
debug( 'Mapping %s to project %s.', $line, $project_match );
|
||||
}
|
||||
|
||||
if ( false === $project_match ) {
|
||||
|
|
Loading…
Reference in New Issue