Merge pull request woocommerce/woocommerce-admin#2433 from woocommerce/changelog/omit-unmerged-prs
Changelog: Omit unmerged pull requests
This commit is contained in:
commit
31f805f651
|
@ -46,6 +46,20 @@ const isCollaborator = async ( username ) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isMergedPullRequest = async ( pullRequestUrl ) => {
|
||||||
|
const options = {
|
||||||
|
url: pullRequestUrl,
|
||||||
|
headers,
|
||||||
|
json: true,
|
||||||
|
};
|
||||||
|
return requestPromise( options )
|
||||||
|
.then( data => data.merged )
|
||||||
|
.catch( err => {
|
||||||
|
console.log( '🤯' );
|
||||||
|
console.log( err.message );
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const writeEntry = async ( content_url ) => {
|
const writeEntry = async ( content_url ) => {
|
||||||
const options = {
|
const options = {
|
||||||
url: content_url,
|
url: content_url,
|
||||||
|
@ -55,6 +69,8 @@ const writeEntry = async ( content_url ) => {
|
||||||
return requestPromise( options )
|
return requestPromise( options )
|
||||||
.then( async data => {
|
.then( async data => {
|
||||||
if ( data.pull_request ) {
|
if ( data.pull_request ) {
|
||||||
|
const isMerged = await isMergedPullRequest( data.pull_request.url );
|
||||||
|
if ( isMerged ) {
|
||||||
const collaborator = await isCollaborator( data.user.login );
|
const collaborator = await isCollaborator( data.user.login );
|
||||||
const type = getPullRequestType( data.labels );
|
const type = getPullRequestType( data.labels );
|
||||||
const labels = getLabels( data.labels );
|
const labels = getLabels( data.labels );
|
||||||
|
@ -63,6 +79,7 @@ const writeEntry = async ( content_url ) => {
|
||||||
const entry = `- ${ type }: ${ data.title } #${ data.number } ${ labelTag } ${ authorTag }`;
|
const entry = `- ${ type }: ${ data.title } #${ data.number } ${ labelTag } ${ authorTag }`;
|
||||||
console.log( entry );
|
console.log( entry );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} )
|
} )
|
||||||
.catch( err => {
|
.catch( err => {
|
||||||
console.log( '🤯' );
|
console.log( '🤯' );
|
||||||
|
|
Loading…
Reference in New Issue