Get only WP L-1
This commit is contained in:
parent
f493e921d5
commit
6af2632f5f
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +1,8 @@
|
|||
const axios = require( 'axios' ).default;
|
||||
const getVersionWPLatestMinusOne = async ( { core, github } ) => {
|
||||
const URL_WP_STABLE_VERSION_CHECK =
|
||||
'https://api.wordpress.org/core/stable-check/1.0/';
|
||||
|
||||
const getPreviousTwoVersions = async () => {
|
||||
const response = await axios
|
||||
.get( 'http://api.wordpress.org/core/stable-check/1.0/' )
|
||||
.catch( ( error ) => {
|
||||
console.log( error.toJSON() );
|
||||
throw new Error( error.message );
|
||||
} );
|
||||
const response = await github.request( URL_WP_STABLE_VERSION_CHECK );
|
||||
|
||||
const body = response.data;
|
||||
const allVersions = Object.keys( body );
|
||||
|
@ -22,34 +18,7 @@ const getPreviousTwoVersions = async () => {
|
|||
( version ) => ! version.startsWith( latestMajorAndMinorNumbers )
|
||||
);
|
||||
|
||||
const latestMinus1MajorAndMinorNumbers = latestMinus1.match(
|
||||
/^\d+.\d+/
|
||||
)[ 0 ];
|
||||
|
||||
const latestMinus2 = previousStableVersions.find(
|
||||
( version ) =>
|
||||
! (
|
||||
version.startsWith( latestMajorAndMinorNumbers ) ||
|
||||
version.startsWith( latestMinus1MajorAndMinorNumbers )
|
||||
)
|
||||
);
|
||||
|
||||
const matrix = {
|
||||
version: [
|
||||
{
|
||||
number: latestMinus1,
|
||||
description: 'WP Latest-1',
|
||||
env_description: 'wp-latest-1',
|
||||
},
|
||||
{
|
||||
number: latestMinus2,
|
||||
description: 'WP Latest-2',
|
||||
env_description: 'wp-latest-2',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
return matrix;
|
||||
core.setOutput( 'version', latestMinus1 );
|
||||
};
|
||||
|
||||
module.exports = { getPreviousTwoVersions };
|
||||
module.exports = { getVersionWPLatestMinusOne };
|
||||
|
|
Loading…
Reference in New Issue