Skip to content

Commit

Permalink
Merge changes published in the Gutenberg plugin "release/18.8" branch
Browse files Browse the repository at this point in the history
  • Loading branch information
gutenbergplugin committed Jul 10, 2024
1 parent aa5b14b commit 1c24e60
Show file tree
Hide file tree
Showing 545 changed files with 21,810 additions and 7,710 deletions.
25 changes: 23 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ const restrictedSyntax = [
const restrictedSyntaxComponents = [
{
selector:
'JSXOpeningElement[name.name="Button"]:not(:has(JSXAttribute[name.name="__experimentalIsFocusable"])) JSXAttribute[name.name="disabled"]',
'JSXOpeningElement[name.name="Button"]:not(:has(JSXAttribute[name.name="accessibleWhenDisabled"])) JSXAttribute[name.name="disabled"]',
message:
'`disabled` used without the `__experimentalIsFocusable` prop. Disabling a control without maintaining focusability can cause accessibility issues, by hiding their presence from screen reader users, or preventing focus from returning to a trigger element. (Ignore this error if you truly mean to disable.)',
'`disabled` used without the `accessibleWhenDisabled` prop. Disabling a control without maintaining focusability can cause accessibility issues, by hiding their presence from screen reader users, or preventing focus from returning to a trigger element. (Ignore this error if you truly mean to disable.)',
},
];

Expand Down Expand Up @@ -397,6 +397,7 @@ module.exports = {
'no-restricted-syntax': [
'error',
...restrictedSyntax,
...restrictedSyntaxComponents,
{
selector:
':matches(Literal[value=/--wp-admin-theme-/],TemplateElement[value.cooked=/--wp-admin-theme-/])',
Expand All @@ -419,6 +420,26 @@ module.exports = {
plugins: [ 'ssr-friendly' ],
extends: [ 'plugin:ssr-friendly/recommended' ],
},
{
files: [ 'packages/components/src/**' ],
rules: {
'no-restricted-imports': [
'error',
// The `ariakit` and `framer-motion` APIs are meant to be consumed via
// the `@wordpress/components` package, hence why importing those
// dependencies should be allowed in the components package.
{
paths: restrictedImports.filter(
( { name } ) =>
! [
'@ariakit/react',
'framer-motion',
].includes( name )
),
},
],
},
},
{
files: [ 'packages/block-editor/**' ],
rules: {
Expand Down
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ packages/edit-site/lib/** linguist-vendored

# The changelog.txt file is authored as markdown.
changelog.txt linguist-language=Markdown

# Flag docs directory as documentation for GitHub stats.
docs/** linguist-documentation
8 changes: 4 additions & 4 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/packages/block-library/src/comment-template @michalczaplinski
/packages/block-library/src/comments @michalczaplinski
/packages/block-library/src/table-of-contents @ZebulanStanphill
/packages/block-library/src/image @artemiomorales @michalczaplinski
/packages/block-library/src/image @artemiomorales

# Duotone
/lib/block-supports/duotone.php
Expand Down Expand Up @@ -119,9 +119,9 @@
/packages/plugins @gziolo @adamsilverstein

# Rich Text
/packages/format-library @ellatrix @fluiddot @dcalhoun
/packages/rich-text @ellatrix @fluiddot @dcalhoun
/packages/block-editor/src/components/rich-text @ellatrix @fluiddot @dcalhoun
/packages/format-library @ellatrix @dcalhoun
/packages/rich-text @ellatrix @dcalhoun
/packages/block-editor/src/components/rich-text @ellatrix @dcalhoun

# Project Management
/.github @desrosj
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/New_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ This issue is to provide visibility on the progress of the release process of Gu

### RC Day - {Weekday, Month, Date}

- [ ] _Optional:_ Attend `#core-editor` meeting (14:00UTC)
- [ ] Post a message in `#core-editor` channel to let folks know you are starting the RC release process
- [ ] Organize and Label PRs on the relevant milestone
- [ ] Start the release process by triggering the `rc` [workflow](https://developer.wordpress.org/block-editor/contributors/code/release/#running-workflow)
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/check-backport-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,15 @@ on:
- '!packages/e2e-tests/**'
jobs:
check:
name: Check CHANGELOG diff
name: Check for a Core backport changelog entry
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.labels.*.name, 'No Core Sync Required') && !contains(github.event.pull_request.labels.*.name, 'Backport from WordPress Core') }}
steps:
- name: 'Get PR commit count'
run: echo "PR_COMMIT_COUNT=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: ${{ env.PR_COMMIT_COUNT }}
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
- name: 'Fetch relevant history from origin'
run: git fetch origin ${{ github.event.pull_request.base.ref }}
- name: Check CHANGELOG status
if: ${{ !contains(github.event.pull_request.labels.*.name, 'No Core Sync Required') && !contains(github.event.pull_request.labels.*.name, 'Backport from WordPress Core') }}
- name: Check the changelog folder
env:
PR_NUMBER: ${{ github.event.number }}
run: |
Expand Down
77 changes: 64 additions & 13 deletions .github/workflows/cherry-pick-wp-release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: Auto Cherry-Pick

on:
push:
branches:
- trunk
# We also want to attempt cherry-picking when a PR is labeled after the PR
# is merged.
pull_request:
types: [closed, labeled]
types: [labeled]
branches:
- trunk

Expand All @@ -14,14 +19,36 @@ concurrency:
jobs:
cherry-pick:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
# When in the context of a PR, ensure the PR is merged.
if: github.event.pull_request == null || github.event.pull_request.merged == true
steps:
- name: Determine if label should trigger cherry-pick
id: label-check
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const labels = context.payload.pull_request.labels.map(label => label.name);
const commit_sha = context.payload.pull_request ? context.payload.pull_request.merge_commit_sha : context.sha;
console.log(`Commit SHA: ${commit_sha}`);
core.exportVariable('commit_sha', commit_sha);
const prs = await github.rest.repos.listPullRequestsAssociatedWithCommit({
owner: context.repo.owner,
repo: context.repo.repo,
commit_sha,
});
if (prs.data.length === 0) {
console.log(`No PR found for commit ${context.sha}.`);
return;
}
const pr_number = prs.data[0].number;
console.log(`PR: ${pr_number}`);
core.exportVariable('pr_number', pr_number);
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr_number,
});
const labels = pr.data.labels.map(label => label.name);
console.log(`Labels: ${labels}`);
const regex = /^Backport to WP ([0-9]+\.[0-9]+) Beta\/RC$/;
let matched = false;
Expand Down Expand Up @@ -59,7 +86,7 @@ jobs:
if: env.cherry_pick == 'true'
run: |
TARGET_BRANCH="wp/${{ env.version }}"
COMMIT_SHA=$(jq -r '.pull_request.merge_commit_sha' "$GITHUB_EVENT_PATH")
COMMIT_SHA="${{ env.commit_sha }}"
echo "Target branch: $TARGET_BRANCH"
echo "Commit SHA: $COMMIT_SHA"
git checkout $TARGET_BRANCH
Expand All @@ -68,9 +95,9 @@ jobs:
echo "conflict=true" >> $GITHUB_ENV
git cherry-pick --abort
else
NEW_COMMIT_SHA=$(git rev-parse HEAD)
CHERRY_PICK_SHA=$(git rev-parse HEAD)
echo "conflict=false" >> $GITHUB_ENV
echo "commit_sha=$NEW_COMMIT_SHA" >> $GITHUB_ENV
echo "cherry_pick_sha=$CHERRY_PICK_SHA" >> $GITHUB_ENV
git push origin $TARGET_BRANCH
fi
Expand All @@ -79,7 +106,7 @@ jobs:
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const prNumber = context.issue.number;
const prNumber = process.env.pr_number;
const version = process.env.version;
console.log(`prNumber: ${prNumber}`);
console.log(`version: ${version}`);
Expand All @@ -103,31 +130,55 @@ jobs:
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const prNumber = context.issue.number;
const commitSha = process.env.commit_sha;
const prNumber = process.env.pr_number;
const cherryPickSha = process.env.cherry_pick_sha;
const targetBranch = `wp/${process.env.version}`;
console.log(`prNumber: ${prNumber}`);
console.log(`commitSha: ${commitSha}`);
console.log(`cherryPickSha: ${cherryPickSha}`);
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}`
body: `I just cherry-picked this PR to the ${targetBranch} branch to get it included in the next release: ${cherryPickSha}`
});
- name: Comment on the PR about conflict
if: env.cherry_pick == 'true' && env.conflict == 'true'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const prNumber = context.issue.number;
const prNumber = process.env.pr_number;
const commitSha = process.env.commit_sha;
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.`
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.
PRs to ${targetBranch} are similar to PRs to trunk, but you should base your PR on the ${targetBranch} branch instead of trunk.
\`\`\`
# Checkout the ${targetBranch} branch instead of trunk.
git checkout ${targetBranch}
# Create a new branch for your PR.
git checkout -b my-branch
# Cherry-pick the commit.
git cherry-pick ${commitSha}
# Check which files have conflicts.
git status
# Resolve the conflict...
# Add the resolved files to the staging area.
git status
git add .
git cherry-pick --continue
# Push the branch to the repository
git push origin my-branch
# Create a PR and set the base to the ${targetBranch} branch.
# See https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-base-branch-of-a-pull-request.
\`\`\`
`
});
76 changes: 76 additions & 0 deletions .github/workflows/sync-backport-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Sync Core Backport Issue

on:
push:
branches:
- trunk

jobs:
sync-backport-changelog:
name: Sync Core Backport Issue
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 2 # Fetch the last two commits to compare changes
- name: Check for changes in backport-changelog
run: |
git diff --quiet HEAD^ HEAD -- backport-changelog || echo "changes=true" >> $GITHUB_OUTPUT
- name: Sync Issue
if: env.changes == 'true'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const labelName = '🤖 Sync Backport Changelog';
const issues = await github.paginate(github.rest.issues.listForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
labels: [labelName],
state: 'open',
per_page: 1,
});
if (issues.length === 0) {
console.log(`No issues found with the "${labelName}" label.`);
return;
}
const [latestIssue] = issues;
const versionMatch = latestIssue.title.match(/(\d+\.\d+)/);
if (!versionMatch) {
console.log('Could not find a version number in the latest issue title.');
return;
}
const version = versionMatch[1];
console.log(`Latest version: ${version}`);
const { execSync } = require('child_process');
const processedChangelog = execSync(`awk '/./ {print ($0 ~ /^[-*]/ ? " " : "- ") $0}' backport-changelog/${version}/*.md`).toString().trim();
const startDelimiter = '<!-- START TRUNK BACKPORT CHANGELOG -->';
const endDelimiter = '<!-- END TRUNK BACKPORT CHANGELOG -->';
const autoGeneratedContent = `${startDelimiter}\n${processedChangelog}\n${endDelimiter}`;
const regex = new RegExp(`${startDelimiter}[\\s\\S]*${endDelimiter}`);
let newBody;
if (regex.test(latestIssue.body)) {
// If delimiters exist, replace the content between them
newBody = latestIssue.body.replace(regex, autoGeneratedContent);
} else {
// If delimiters don't exist, append the new content at the end
newBody = `${latestIssue.body}\n\n${autoGeneratedContent}`;
}
if (newBody.trim() !== latestIssue.body.trim()) {
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: latestIssue.number,
body: newBody
});
console.log('Issue description updated successfully.');
} else {
console.log('Issue description is already up to date.');
}
1 change: 1 addition & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "./schemas/json/wp-env.json",
"core": "WordPress/WordPress",
"plugins": [ "." ],
"themes": [ "./test/emptytheme" ],
Expand Down
4 changes: 4 additions & 0 deletions backport-changelog/6.6/6959.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
https://github.com/WordPress/wordpress-develop/pull/6959

* https://github.com/WordPress/gutenberg/pull/63071

3 changes: 3 additions & 0 deletions backport-changelog/6.6/6987.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/6987

* https://github.com/WordPress/gutenberg/pull/63207
3 changes: 3 additions & 0 deletions backport-changelog/6.6/6989.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/6989

* https://github.com/WordPress/gutenberg/pull/63172
3 changes: 3 additions & 0 deletions backport-changelog/6.7/6668.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/6668

* https://github.com/WordPress/gutenberg/pull/62092
3 changes: 3 additions & 0 deletions backport-changelog/6.7/6836.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/6836

* https://github.com/WordPress/gutenberg/pull/60100
6 changes: 6 additions & 0 deletions backport-changelog/6.7/6910.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
https://github.com/WordPress/wordpress-develop/pull/6910

* https://github.com/WordPress/gutenberg/pull/59483
* https://github.com/WordPress/gutenberg/pull/60652
* https://github.com/WordPress/gutenberg/pull/62777
* https://github.com/WordPress/gutenberg/pull/63108
Loading

0 comments on commit 1c24e60

Please sign in to comment.