Skip to content

Commit

Permalink
Merge changes published in the Gutenberg plugin "release/17.6" branch
Browse files Browse the repository at this point in the history
  • Loading branch information
gutenbergplugin committed Jan 24, 2024
1 parent 5e6f9ca commit 0581398
Show file tree
Hide file tree
Showing 728 changed files with 30,150 additions and 28,983 deletions.
40 changes: 39 additions & 1 deletion bin/api-docs/gen-theme-reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,42 @@ const keys = ( maybeObject ) => {
return Object.keys( maybeObject );
};

/**
* Get definition from ref.
*
* @param {string} ref
* @return {Object} definition
* @throws {Error} If the referenced definition is not found in 'themejson.definitions'.
*
* @example
* getDefinition( '#/definitions/typographyProperties/properties/fontFamily' )
* // returns themejson.definitions.typographyProperties.properties.fontFamily
*/
const resolveDefinitionRef = ( ref ) => {
const refParts = ref.split( '/' );
const definition = refParts[ refParts.length - 1 ];
if ( ! themejson.definitions[ definition ] ) {
throw new Error( `Can't resolve '${ ref }'. Definition not found` );
}
return themejson.definitions[ definition ];
};

/**
* Get properties from an array.
*
* @param {Object} items
* @return {Object} properties
*/
const getPropertiesFromArray = ( items ) => {
// if its a $ref resolve it
if ( items.$ref ) {
return resolveDefinitionRef( items.$ref ).properties;
}

// otherwise just return the properties
return items.properties;
};

/**
* Convert settings properties to markup.
*
Expand All @@ -96,7 +132,9 @@ const getSettingsPropertiesMarkup = ( struct ) => {
const def = 'default' in props[ key ] ? props[ key ].default : '';
const ps =
props[ key ].type === 'array'
? keys( props[ key ].items.properties ).sort().join( ', ' )
? keys( getPropertiesFromArray( props[ key ].items ) )
.sort()
.join( ', ' )
: '';
markup += `| ${ key } | ${ props[ key ].type } | ${ def } | ${ ps } |\n`;
} );
Expand Down
25 changes: 16 additions & 9 deletions bin/cherry-pick.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const LABEL = process.argv[ 2 ] || 'Backport to WP Beta/RC';
const BRANCH = getCurrentBranch();
const GITHUB_CLI_AVAILABLE = spawnSync( 'gh', [ 'auth', 'status' ] )
?.stdout?.toString()
.includes( '✓ Logged in to github.com as' );
.includes( '✓ Logged in to github.com' );

const AUTO_PROPAGATE_RESULTS_TO_GITHUB = GITHUB_CLI_AVAILABLE;

Expand Down Expand Up @@ -114,16 +114,23 @@ async function fetchPRs() {
const { items } = await GitHubFetch(
`/search/issues?q=is:pr state:closed sort:updated label:"${ LABEL }" repo:WordPress/gutenberg`
);
const PRs = items.map( ( { id, number, title, pull_request, closed_at } ) => ( {
id,
number,
title,
pull_request,
} ) )
const PRs = items
.map( ( { id, number, title, pull_request, closed_at } ) => ( {
id,
number,
title,
pull_request,
} ) )
.filter( ( { pull_request } ) => !! pull_request?.merged_at )
.sort( ( a, b ) => new Date( a?.pull_request?.merged_at ) - new Date( b?.pull_request?.merged_at ) );
.sort(
( a, b ) =>
new Date( a?.pull_request?.merged_at ) -
new Date( b?.pull_request?.merged_at )
);

console.log( 'Found the following PRs to cherry-pick (sorted by closed date in ascending order): ' );
console.log(
'Found the following PRs to cherry-pick (sorted by closed date in ascending order): '
);
PRs.forEach( ( { number, title } ) =>
console.log( indent( `#${ number }${ title }` ) )
);
Expand Down
Loading

1 comment on commit 0581398

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 0581398.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7646557907
📝 Reported issues:

Please sign in to comment.