Merge pull request woocommerce/woocommerce-admin#2437 from woocommerce/fix/changelog-note-option

Changelog script: Use PR author note, if supplied
This commit is contained in:
Paul Sealock 2019-06-18 22:29:10 +12:00 committed by GitHub
commit 4edc9cdb9e
2 changed files with 17 additions and 2 deletions

View File

@ -23,4 +23,4 @@ be sure to detail parts affected in Release Notes --->
### Changelog Note: ### Changelog Note:
<!--- Please follow the WooCommerce core format using prefixes of Enhancement, Tweak, Dev, Fix ---> <!--- Optional: Enter a changelog note following the WooCommerce core format using prefixes of Enhancement:, Tweak:, Dev:, Fix:, Performance:. If no note is entered, one will be constructed from the title and labels. --->

View File

@ -76,7 +76,22 @@ const writeEntry = async ( content_url ) => {
const labels = getLabels( data.labels ); const labels = getLabels( data.labels );
const labelTag = labels.length ? `(${ labels })` : ''; const labelTag = labels.length ? `(${ labels })` : '';
const authorTag = collaborator ? '' : `👏 @${ data.user.login }`; const authorTag = collaborator ? '' : `👏 @${ data.user.login }`;
const entry = `- ${ type }: ${ data.title } #${ data.number } ${ labelTag } ${ authorTag }`; let title;
if ( /### Changelog Note/.test( data.body ) ) {
const bodyParts = data.body.split( '### Changelog Note:' );
const note = bodyParts[ bodyParts.length - 1 ];
title = note
// Remove comment prompt
.replace( /<!---(.*)--->/gm, '' )
// Remove new lines and whitespace
.trim();
if ( ! title.length ) {
title = `${ type }: ${ data.title }`;
}
} else {
title = `${ type }: ${ data.title }`;
}
const entry = `- ${ title } #${ data.number } ${ labelTag } ${ authorTag }`;
console.log( entry ); console.log( entry );
} }
} }