Skip to content

Commit

Permalink
Merge branch 'trunk' into fix/long-post-titles
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskoster committed Jun 25, 2024
2 parents c3c4f06 + 5993ecb commit 25f8889
Show file tree
Hide file tree
Showing 47 changed files with 1,595 additions and 716 deletions.
133 changes: 133 additions & 0 deletions .github/workflows/cherry-pick-wp-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Auto Cherry-Pick

on:
pull_request:
types: [closed, labeled]
branches:
- trunk

# Ensure that new jobs wait for the previous job to finish.
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

jobs:
cherry-pick:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Determine if label should trigger cherry-pick
id: label-check
uses: actions/github-script@v7
with:
script: |
const labels = context.payload.pull_request.labels.map(label => label.name);
console.log(`Labels: ${labels}`);
const regex = /^Backport to WP ([0-9]+\.[0-9]+) Beta\/RC$/;
let matched = false;
for (const label of labels) {
const match = label.match(regex);
if (match) {
const version = match[1];
console.log(`Matched label: ${label}`);
console.log(`Extracted version: ${version}`);
core.exportVariable('cherry_pick', 'true');
core.exportVariable('version', version);
matched = true;
break;
}
}
if (!matched) {
core.exportVariable('cherry_pick', 'false');
}
- name: Checkout repository
if: env.cherry_pick == 'true'
uses: actions/checkout@v2
with:
token: ${{ secrets.GUTENBERG_TOKEN }}
fetch-depth: 0

- name: Set up Git
if: env.cherry_pick == 'true'
run: |
git config --global user.name "Gutenberg Repository Automation"
git config --global user.email "gutenberg@wordpress.org"
- name: Cherry-pick the commit
id: cherry-pick
if: env.cherry_pick == 'true'
run: |
TARGET_BRANCH="wp/${{ env.version }}"
COMMIT_SHA=$(jq -r '.pull_request.merge_commit_sha' "$GITHUB_EVENT_PATH")
echo "Target branch: $TARGET_BRANCH"
echo "Commit SHA: $COMMIT_SHA"
git checkout $TARGET_BRANCH
git cherry-pick $COMMIT_SHA || echo "cherry-pick-failed" > result
if [ -f result ] && grep -q "cherry-pick-failed" result; then
echo "conflict=true" >> $GITHUB_ENV
git cherry-pick --abort
else
NEW_COMMIT_SHA=$(git rev-parse HEAD)
echo "conflict=false" >> $GITHUB_ENV
echo "commit_sha=$NEW_COMMIT_SHA" >> $GITHUB_ENV
git push origin $TARGET_BRANCH
fi
- name: Remove cherry-pick label
if: env.cherry_pick == 'true' && env.conflict == 'false'
uses: actions/github-script@v7
with:
script: |
const prNumber = context.issue.number;
const version = process.env.version;
console.log(`prNumber: ${prNumber}`);
console.log(`version: ${version}`);
const oldLabel = `Backport to WP ${version} Beta/RC`;
const newLabel = `Backported to WP Core`;
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
name: oldLabel
});
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
labels: [newLabel]
});
- name: Comment on the PR
if: env.cherry_pick == 'true' && env.conflict == 'false'
uses: actions/github-script@v7
with:
script: |
const prNumber = context.issue.number;
const commitSha = process.env.commit_sha;
const targetBranch = `wp/${process.env.version}`;
console.log(`prNumber: ${prNumber}`);
console.log(`commitSha: ${commitSha}`);
console.log(`targetBranch: ${targetBranch}`);
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: `I just cherry-picked this PR to the ${targetBranch} branch to get it included in the next release: ${commitSha}`
});
- name: Comment on the PR about conflict
if: env.cherry_pick == 'true' && env.conflict == 'true'
uses: actions/github-script@v7
with:
script: |
const prNumber = context.issue.number;
const targetBranch = `wp/${process.env.version}`;
console.log(`prNumber: ${prNumber}`);
console.log(`targetBranch: ${targetBranch}`);
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: `There was a conflict while trying to cherry-pick the commit to the ${targetBranch} branch. Please resolve the conflict manually and create a PR to the ${targetBranch} branch.`
});
21 changes: 21 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
== Changelog ==

= 18.6.1 =


## Changelog

### Bug Fixes

#### Block Library
- Navigation block: Fix submenu not opening on macOS Safari. ([62800](https://github.com/WordPress/gutenberg/pull/62800))

### Code Quality
- Template Part: Improve how the tag name attribute is handled (#62785)(https://github.com/WordPress/gutenberg/pull/62785)


## Contributors

The following contributors merged PRs in this release:

@luisherranz @aaronjorbin @gziolo @westonruter @cbravobernal


= 18.6.0 =

## Changelog
Expand Down
28 changes: 16 additions & 12 deletions docs/reference-guides/interactivity-api/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ The `wp-interactive` directive "activates" the interactivity for the DOM element
</div>
```

> **Note**
> The use of `data-wp-interactive` is a requirement for the Interactivity API "engine" to work. In the following examples the `data-wp-interactive` has not been added for the sake of simplicity. Also, the `data-wp-interactive` directive will be injected automatically in the future.
<div class="callout callout-info">
The use of <code>data-wp-interactive</code> is a requirement for the Interactivity API "engine" to work. In the following examples the <code>data-wp-interactive</code> has not been added for the sake of simplicity. Also, the <code>data-wp-interactive</code> directive will be injected automatically in the future.
</div>

### `wp-context`

Expand Down Expand Up @@ -299,8 +300,9 @@ The returned value is used to change the inner content of the element: `<div>val

### `wp-on`

> [!NOTE]
> Consider using the more performant [`wp-on-async`](#wp-on-async) instead if your directive code does not need synchronous access to the event object. If synchronous access is required, consider implementing an [async action](#async-actions) which yields to the main thread after calling the synchronous API.
<div class="callout callout-info">
Consider using the more performant <a href="#wp-on-async"><code>wp-on-async</code></a> instead if your directive code does not need synchronous access to the event object. If synchronous access is required, consider implementing an <a href="#async-actions"><code>async action</code></a> which yields to the main thread after calling the synchronous API.
</div>

This directive runs code on dispatched DOM events like `click` or `keyup`. The syntax is `data-wp-on--[event]` (like `data-wp-on--click` or `data-wp-on--keyup`).

Expand Down Expand Up @@ -335,8 +337,9 @@ to run sooner. Use this async version whenever there is no need for synchronous

### `wp-on-window`

> [!NOTE]
> Consider using the more performant [`wp-on-async-window`](#wp-on-async-window) instead if your directive code does not need synchronous access to the event object. If synchronous access is required, consider implementing an [async action](#async-actions) which yields to the main thread after calling the synchronous API.
<div class="callout callout-info">
Consider using the more performant <a href="#wp-on-async-window"><code>wp-on-async-window</code></a> instead if your directive code does not need synchronous access to the event object. If synchronous access is required, consider implementing an <a href="#async-actions"><code>async action</code></a> which yields to the main thread after calling the synchronous API.
</div>

This directive allows you to attach global window events like `resize`, `copy`, and `focus` and then execute a defined callback when those happen.

Expand Down Expand Up @@ -371,8 +374,9 @@ Similar to `wp-on-async`, this is an optimized version of `wp-on-window` that im

### `wp-on-document`

> [!NOTE]
> Consider using the more performant [`wp-on-async-document`](#wp-on-async-document) instead if your directive code does not need synchronous access to the event object. If synchronous access is required, consider implementing an [async action](#async-actions) which yields to the main thread after calling the synchronous API.
<div class="callout callout-info">
Consider using the more performant <a href="#wp-on-async-document"><code>wp-on-async-document</code></a> instead if your directive code does not need synchronous access to the event object. If synchronous access is required, consider implementing an <a href="#async-actions"><code>async action</code></a> which yields to the main thread after calling the synchronous API.
</div>

This directive allows you to attach global document events like `scroll`, `mousemove`, and `keydown` and then execute a defined callback when those happen.

Expand Down Expand Up @@ -759,7 +763,7 @@ const { state, actions } = store("myPlugin", {
});
```

##### Async actions
<h5 id="async-actions">Async actions</h5>

Async actions should use generators instead of async/await.

Expand Down Expand Up @@ -889,9 +893,9 @@ const { state } = store( "myPlugin", {
}
} );
```

> **Note**
> All `store()` calls with the same namespace return the same references, i.e., the same `state`, `actions`, etc., containing the result of merging all the store parts passed.
<div class="callout callout-info">
All <code>store()</code> calls with the same namespace return the same references, i.e., the same <code>state</code>, <code>actions</code>, etc., containing the result of merging all the store parts passed.
</div>

- To access the context inside an action, derived state, or side effect, you can use the `getContext` function.
- To access the reference, you can use the `getElement` function.
Expand Down
2 changes: 1 addition & 1 deletion gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Printing since 1440. This is the development plugin for the block editor, site editor, and other future WordPress core functionality.
* Requires at least: 6.4
* Requires PHP: 7.2
* Version: 18.6.0
* Version: 18.6.1
* Author: Gutenberg Team
* Text Domain: gutenberg
*
Expand Down
48 changes: 26 additions & 22 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -2326,43 +2326,37 @@ protected static function flatten_tree( $tree, $prefix = '', $token = '--' ) {
* @return array Returns the modified $declarations.
*/
protected static function compute_style_properties( $styles, $settings = array(), $properties = null, $theme_json = null, $selector = null, $use_root_padding = null ) {
if ( null === $properties ) {
$properties = static::PROPERTIES_METADATA;
}

$declarations = array();
if ( empty( $styles ) ) {
return $declarations;
return array();
}

if ( null === $properties ) {
$properties = static::PROPERTIES_METADATA;
}
$declarations = array();
$root_variable_duplicates = array();
$root_style_length = strlen( '--wp--style--root--' );

foreach ( $properties as $css_property => $value_path ) {
$value = static::get_property_value( $styles, $value_path, $theme_json );
if ( ! is_array( $value_path ) ) {
continue;
}

if ( str_starts_with( $css_property, '--wp--style--root--' ) && ( static::ROOT_BLOCK_SELECTOR !== $selector || ! $use_root_padding ) ) {
$is_root_style = str_starts_with( $css_property, '--wp--style--root--' );
if ( $is_root_style && ( static::ROOT_BLOCK_SELECTOR !== $selector || ! $use_root_padding ) ) {
continue;
}

$value = static::get_property_value( $styles, $value_path, $theme_json );

// Root-level padding styles don't currently support strings with CSS shorthand values.
// This may change: https://github.com/WordPress/gutenberg/issues/40132.
if ( '--wp--style--root--padding' === $css_property && is_string( $value ) ) {
continue;
}

if ( str_starts_with( $css_property, '--wp--style--root--' ) && $use_root_padding ) {
$root_variable_duplicates[] = substr( $css_property, strlen( '--wp--style--root--' ) );
}

// Look up protected properties, keyed by value path.
// Skip protected properties that are explicitly set to `null`.
if ( is_array( $value_path ) ) {
$path_string = implode( '.', $value_path );
if (
isset( static::PROTECTED_PROPERTIES[ $path_string ] ) &&
_wp_array_get( $settings, static::PROTECTED_PROPERTIES[ $path_string ], null ) === null
) {
continue;
}
if ( $is_root_style && $use_root_padding ) {
$root_variable_duplicates[] = substr( $css_property, $root_style_length );
}

// Processes background styles.
Expand All @@ -2377,6 +2371,16 @@ protected static function compute_style_properties( $styles, $settings = array()
continue;
}

// Look up protected properties, keyed by value path.
// Skip protected properties that are explicitly set to `null`.
$path_string = implode( '.', $value_path );
if (
isset( static::PROTECTED_PROPERTIES[ $path_string ] ) &&
_wp_array_get( $settings, static::PROTECTED_PROPERTIES[ $path_string ], null ) === null
) {
continue;
}

// Calculates fluid typography rules where available.
if ( 'font-size' === $css_property ) {
/*
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gutenberg",
"version": "18.6.0",
"version": "18.6.1",
"private": true,
"description": "A new WordPress editor experience.",
"author": "The WordPress Contributors",
Expand Down
Loading

0 comments on commit 25f8889

Please sign in to comment.