Changelogger: Fix JS package epilogues (#33645)

This commit is contained in:
Paul Sealock 2022-06-30 08:09:46 +12:00 committed by GitHub
parent a80e0fe203
commit 23c7046df0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View File

@ -63,6 +63,13 @@ class Formatter extends KeepAChangelogParser {
*/
public $subentry_pattern = '/^###(.+)\n/m';
/**
* Return the epiologue.
*/
public function getEpilogue() {
return $this->epilogue;
}
/**
* Get Release link given a version number.
*
@ -219,7 +226,7 @@ class Formatter extends KeepAChangelogParser {
$ret->setEntries( $entries );
$ret->setPrologue( $this->prologue );
$ret->setEpilogue( $this->epilogue );
$ret->setEpilogue( $this->getEpilogue() );
return $ret;
}

View File

@ -24,9 +24,13 @@ class PackageFormatter extends Formatter implements FormatterPlugin {
public $prologue = "# Changelog \n\nThis project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).";
/**
* Epilogue text.
*
* @var string
* Return the epilogue string based on the package being released.
*/
public $epilogue = "---\n\n[See legacy changelogs for previous versions](https://github.com/woocommerce/woocommerce-admin/blob/main/packages/components/CHANGELOG.md).";
public function getEpilogue() {
$cwd = getcwd();
$pos = stripos( $cwd, 'packages/js/' );
$package = substr( $cwd, $pos + 12 );
return '[See legacy changelogs for previous versions](https://github.com/woocommerce/woocommerce/blob/68581955106947918d2b17607a01bdfdf22288a9/packages/js/' . $package . '/CHANGELOG.md).';
}
}