Skip to content

Commit 1f951e5

Browse files
Merge branch 'trunk' into fix/playlist-waveform-player-remove-patch
2 parents a197e02 + 82babb5 commit 1f951e5

55 files changed

Lines changed: 1186 additions & 189 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/check-package-changelogs.yml‎

Lines changed: 74 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: OPTIONAL - Verify package CHANGELOG updates
1+
name: Verify package CHANGELOG updates
22

33
on:
44
pull_request:
@@ -22,17 +22,21 @@ on:
2222
- 'packages/widget-dashboard/**'
2323
- 'packages/widget-primitives/**'
2424
- 'packages/wp-build/**'
25+
- 'packages/*/CHANGELOG.md'
26+
- 'tools/validation/validate-changelogs.ts'
27+
- '.github/workflows/check-package-changelogs.yml'
2528
- '!packages/*/src/**/stories/**'
2629
- '!packages/*/src/**/test/**'
27-
- '!packages/*/CHANGELOG.md'
2830

2931
# Disable permissions for all available scopes by default.
3032
# Any needed permissions should be configured at the job level.
3133
permissions: {}
3234

3335
jobs:
34-
check:
35-
name: Check CHANGELOG diff (${{ matrix.package }})
36+
# Presence: The allowlisted packages listed in the matrix have stricter
37+
# expectations around changes having an accompanying changelog note.
38+
presence:
39+
name: Check CHANGELOG presence (${{ matrix.package }})
3640
runs-on: 'ubuntu-24.04'
3741
permissions:
3842
contents: read
@@ -87,12 +91,25 @@ jobs:
8791
| grep -Ev "^${PACKAGE_PATH}/(src/(.+/)?(stories|test)/|CHANGELOG\.md$)" || true)
8892
8993
if [ -z "$relevant_changes" ]; then
90-
echo "No relevant changes under ${PACKAGE_PATH}; skipping CHANGELOG check."
94+
echo "No relevant changes under ${PACKAGE_PATH}; skipping CHANGELOG presence check."
9195
echo "has_changes=false" >> "$GITHUB_OUTPUT"
9296
else
9397
echo "has_changes=true" >> "$GITHUB_OUTPUT"
9498
fi
95-
- name: Check CHANGELOG status
99+
# This intentionally doesn't use `.github/setup-node`, because we
100+
# don't currently need to `npm ci` install any dependencies.
101+
- name: Use desired version of Node.js
102+
if: steps.filter.outputs.has_changes == 'true'
103+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
104+
with:
105+
node-version-file: '.nvmrc'
106+
package-manager-cache: false
107+
- name: Set up npm
108+
if: steps.filter.outputs.has_changes == 'true'
109+
uses: ./.github/setup-npm
110+
with:
111+
cache: false
112+
- name: Check CHANGELOG cites this PR
96113
if: steps.filter.outputs.has_changes == 'true'
97114
env:
98115
PR_NUMBER: ${{ github.event.number }}
@@ -104,30 +121,60 @@ jobs:
104121
105122
# Fail if the PR doesn't touch the changelog
106123
if git diff --quiet "$BASE_SHA"...HEAD -- "$changelog_path"; then
107-
echo "Please add a CHANGELOG entry to $changelog_path"
108-
echo
109-
echo "${optional_check_notice}"
110-
exit 1
111-
fi
112-
113-
pr_link_pattern="\[#${PR_NUMBER}\]\(https://github\.com/WordPress/gutenberg/pull/${PR_NUMBER}\)"
114-
pr_link_grep_pattern="\[#${PR_NUMBER}\](https://github\.com/WordPress/gutenberg/pull/${PR_NUMBER})"
115-
116-
unreleased_section=$(sed -n '/^## Unreleased$/,/^## /p' "${changelog_path}")
117-
118-
# Confirm that the CHANGELOG has an entry for the current PR
119-
if ! grep -nq -e "${pr_link_grep_pattern}" "${changelog_path}"; then
120-
echo "Please add a CHANGELOG entry to $changelog_path, and make sure your CHANGELOG entry has a link to the current PR."
124+
echo "Please add a CHANGELOG entry to $changelog_path"
121125
echo
122126
echo "${optional_check_notice}"
123127
exit 1
124128
fi
125129
126-
# Confirm that there is an 'Unreleased' section and that the relevant entry is in that section
127-
if ! grep -nq -e '^## Unreleased' "${changelog_path}" || \
128-
! [[ $unreleased_section = *${pr_link_pattern}* ]]; then
129-
echo "Please make sure your CHANGELOG entry is in the \`## Unreleased\` section"
130-
echo
131-
echo "${optional_check_notice}"
132-
exit 1
130+
# Confirm that the CHANGELOG has a valid entry for the current PR
131+
npm run lint:changelogs -- --require-pr="${PR_NUMBER}" "${changelog_path}"
132+
133+
# Structure: For any revisions to CHANGELOGs (regardless of package),
134+
# validate that the contents follow the expected format.
135+
structure:
136+
name: Validate CHANGELOG structure
137+
runs-on: 'ubuntu-24.04'
138+
permissions:
139+
contents: read
140+
steps:
141+
- name: 'Get PR commit count'
142+
env:
143+
PR_COUNT: ${{ github.event.pull_request.commits }}
144+
run: echo "PR_COMMIT_COUNT=$(( PR_COUNT + 1 ))" >> "${GITHUB_ENV}"
145+
- name: Checkout code
146+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
147+
with:
148+
ref: ${{ github.event.pull_request.head.ref }}
149+
repository: ${{ github.event.pull_request.head.repo.full_name }}
150+
fetch-depth: ${{ env.PR_COMMIT_COUNT }}
151+
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
152+
persist-credentials: false
153+
- name: 'Fetch relevant history from base repository'
154+
run: git fetch "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" "$GITHUB_BASE_REF"
155+
# This intentionally doesn't use `.github/setup-node`, because we
156+
# don't currently need to `npm ci` install any dependencies.
157+
- name: Use desired version of Node.js
158+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
159+
with:
160+
node-version-file: '.nvmrc'
161+
package-manager-cache: false
162+
- name: Set up npm
163+
uses: ./.github/setup-npm
164+
with:
165+
cache: false
166+
- name: Validate touched CHANGELOG files
167+
env:
168+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
169+
PR_NUMBER: ${{ github.event.number }}
170+
run: |
171+
changelogs=$(git diff --name-only --diff-filter=d "$BASE_SHA"...HEAD -- 'packages/*/CHANGELOG.md')
172+
173+
if [ -z "$changelogs" ]; then
174+
echo "No package CHANGELOG.md files changed; skipping structure check."
175+
exit 0
133176
fi
177+
178+
echo "Validating:"
179+
echo "$changelogs"
180+
echo "$changelogs" | xargs npm run lint:changelogs -- --pr="${PR_NUMBER}"

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ For full architecture details, see `docs/explanations/architecture/`.
9191
- Pages and routes are stable by default. Mark experimental pages with `"experimental": true` in `wpPlugin.pages`; WordPress Core builds exclude those pages and routes used only by experimental pages. Do not introduce separate `stable` or `core` flags for this distinction.
9292
- Never invoke a CLI through `npx`. When the binary is missing locally, `npx` installs whatever the public registry serves under that name: WordPress ships its own `wp-prettier` fork, and a bare `npx wp-scripts` can resolve to an unrelated third-party package rather than `@wordpress/scripts`. Use the npm scripts (`npm run format`, `npm run lint:js`, `npm run lint:css` and so on), which run the binaries from local `node_modules`. Where no script fits, use `npm exec --no -- <binary>` (adding `--workspace <name>` when the workspace that declares the dependency is not the one you are in), which fails instead of downloading. A bare `npm exec` behaves exactly like `npx`, so it needs `--no` too. The exception is a doc example handing the reader a tool they have not installed, such as `npx @wordpress/create-block@latest`: it names an exact package rather than a hijackable bin name.
9393
- PHP function and class names are renamed at build time (`gutenberg_*` prefix, `*_Gutenberg` suffix) to avoid conflicts with WordPress Core — the built names, not the source names, are what runs (and what tests must call). See `docs/contributors/code/build-system-function-prefixing.md`.
94-
- Code changes in a package that have an external impact to consumers should be accompanied by an entry in that package's `CHANGELOG.md`. Entries in the changelog should have a PR reference. In some cases you may not know the PR reference, ask the user. See `docs/contributors/code/managing-packages.md`.
94+
- Code changes in a package that have an external impact to consumers should be accompanied by an entry in that package's `CHANGELOG.md`. Follow the formatting structure described in [Maintaining Changelogs](packages/README.md#maintaining-changelogs).
9595
- Packages with TypeScript dev files split their configs: `tsconfig.build.json` (src only, emits `build-types`) and the default `tsconfig.json` (dev project: tests and stories, `noEmit`, jest types). Packages without dev files keep a single `tsconfig.json` build project, and a few packages deviate (a dev-only project with handwritten declarations, or specialized build projects); see the TypeScript section in `packages/README.md`. Reference a split package by `../<pkg>/tsconfig.build.json` and an unsplit one by `../<pkg>`. `npm run build` never type checks (it emits declarations with `--noCheck`); use `npm run typecheck`, and never add jest types to a build project.
9696
- A rejected `apiFetch` is not always an `Error`: a REST error arrives as a plain object (`{ code, message, data }`), `parse: false` rejects with the `Response` (which carries `status`, not `message`), an aborted request rethrows an `AbortError`, and a handler set via `setFetchHandler` can reject anything. Do not interpolate the rejection into a string (`` `${ error }` `` gives `[object Object]`) or branch on `instanceof Error`. Normalise it to a message before showing the user anything, and supply your own copy when there is none — `ensureError` in `packages/core-data/src/private-actions.js` is the reference implementation, though it is local to that file rather than exported.
9797

‎package-lock.json‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
"lint:lockfile": "npm run --workspace @wordpress/validation-tools validate-package-lock --",
149149
"lint:package-contents": "npm run --if-present --workspaces lint:package-contents",
150150
"lint:tsconfig": "npm run --workspace @wordpress/validation-tools validate-tsconfig --",
151+
"lint:changelogs": "npm run --workspace @wordpress/validation-tools validate-changelogs --",
151152
"lint:md:docs": "wp-scripts lint-md-docs",
152153
"prelint:php": "npm run other:update-packages:php",
153154
"lint:php": "wp-env run --env-cwd='wp-content/plugins/gutenberg' cli composer run-script lint",

‎packages/README.md‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,15 @@ See [Testing published packages across WordPress versions](/docs/contributors/co
268268
269269
## Maintaining Changelogs
270270
271-
When maintaining dozens of npm packages, it can be tough to keep track of changes. To simplify the release process, each package includes a `CHANGELOG.md` file which details all published releases and the unreleased ("Unreleased") changes, if any exist.
271+
Each package keeps a `CHANGELOG.md` so the release process can see what changed since the last publish. Put new entries under `## Unreleased` at the top of the file, or create the heading if it is missing.
272272
273-
For each pull request, you should always include relevant changes under an "Unreleased" heading at the top of the file. You should add the heading if it doesn't already exist.
273+
Prefer an entry for anything that affects package consumers. Changelog entries are optional for trivial or for changes that don't impact the user or consumer. Internal changes can be added under an **Internal** heading.
274274

275-
_Example:_
275+
### Changelog Entry Format
276+
277+
Under the "Unreleased" heading, add entries as list items under an appropriate `###` subheading (see ["Changelog Subsections"](#changelog-subsections)). Each top-level bullet should end with a link to the pull request and a period.
278+
279+
Example:
276280

277281
```md
278282
<!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->
@@ -281,16 +285,16 @@ _Example:_
281285
282286
### Bug Fixes
283287
284-
- Fixed an off-by-one error with the `sum` function.
288+
- Fixed an off-by-one error with the `sum` function ([#12347](https://github.com/WordPress/gutenberg/pull/12347)).
285289
```
286290

291+
You can verify the structure locally by running `npm run lint:changelogs`.
292+
287293
### Promoting a Pre-Release Package to Stable (1.0.0)
288294

289295
The automated package publishing workflow will at most bump the minor version of a pre-release package (those having a version like `0.x.x`), even if it includes breaking changes. This is consistent with semantic versioning, where `0.x` versions are intended for initial development where the API may change frequently.
290296

291-
When a package's API is considered stable and ready for production use, it should be promoted to version 1.0.0. This is done by adding a "Stable Release" section to the `CHANGELOG.md` file:
292-
293-
_Example:_
297+
A `0.x` package is promoted to `1.0.0` by adding a **Stable Release** section.
294298

295299
```md
296300
## Unreleased
@@ -301,7 +305,7 @@ This package is now considered stable and production-ready. The API will follow
301305
302306
### Breaking Changes
303307
304-
- Final API adjustments before 1.0.0 release.
308+
- Final API adjustments before 1.0.0 release ([#12345](https://github.com/WordPress/gutenberg/pull/12345)).
305309
```
306310

307311
The presence of the "Stable Release" heading will cause the automated release process to bump a pre-1.0 package to 1.0.0. The "Stable Release" heading should only be used for pre-1.0 packages, and from that point forward breaking changes will result in major version bumps as expected.
@@ -310,17 +314,16 @@ The presence of the "Stable Release" heading will cause the automated release pr
310314

311315
There are a number of common release subsections you can follow. Each is intended to align to a specific meaning in the context of the [Semantic Versioning (`semver`) specification](https://semver.org/) the project adheres to. It is important that you describe your changes accurately, since this is used in the packages release process to help determine the version of the next release.
312316

317+
Use the following standardized section headings and ordering based on the type of change you are making:
318+
319+
- "Stable Release" - Marks a pre-1.0 package as stable and production-ready. This should only be used for packages currently published as a 0.x pre-release, to intentionally communicate that a package's API is now stable and ready for production use.
313320
- "Breaking Changes" - A backwards-incompatible change which requires specific attention of the impacted developers to reconcile (requires a major version bump for stable packages).
314321
- "New Features" - The addition of a new backwards-compatible function or feature to the existing public API (requires a minor version bump).
315322
- "Enhancements" - Backwards-compatible improvements to existing functionality (requires a minor version bump).
316323
- "Deprecations" - Deprecation notices. These do not impact the public interface or behavior of the module (requires a minor version bump).
317324
- "Bug Fixes" - Resolutions to existing buggy behavior (requires a patch version bump).
318325
- "Internal" - Changes which do not have an impact on the public interface or behavior of the module (requires a patch version bump).
319-
- "Stable Release" - Marks a pre-1.0 package as stable and production-ready. This should only be used for packages currently published as a 0.x pre-release, to intentionally communicate that a package's API is now stable and ready for production use.
320-
321-
While other section naming can be used when appropriate, it's important that are expressed clearly to avoid confusion for both the packages releaser and third-party consumers.
322-
323-
When in doubt, refer to [Semantic Versioning specification](https://semver.org/).
326+
- "Documentation" - Changes affecting consumer documentation.
324327
325328
If you are publishing new versions of packages, note that there are versioning recommendations outlined in the [Gutenberg Release Process document](https://github.com/WordPress/gutenberg/blob/HEAD/docs/contributors/code/release/README.md) which prescribe _minimum_ version bumps for specific types of releases. The chosen version should be the greater of the two between the semantic versioning and Gutenberg release minimum version bumps.
326329

‎packages/block-editor/CHANGELOG.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
## Unreleased
44

5-
### Internal
6-
7-
- Remove the `crossorigin` MutationObserver. Under `Document-Isolation-Policy: isolate-and-credentialless` cross-origin resources load without the attribute, and adding it broke any resource served without CORS headers ([#82614](https://github.com/WordPress/gutenberg/pull/82614)).
8-
95
### New Features
106

117
- Add a text shadow block support and its control in the typography panel ([#79584](https://github.com/WordPress/gutenberg/pull/79584)).
@@ -16,6 +12,7 @@
1612
- `BlockCard`: Migrate the block-type badge from the private Components `Badge` to `@wordpress/ui` `Badge`. ([#82503](https://github.com/WordPress/gutenberg/pull/82503)).
1713
- Inspector controls in the standard block-supports panels (Typography, Dimensions, Border, Color, Background, Filters) reflect the value a block inherits from Global Styles when nothing is set on the block. The `gutenberg-global-styles-inheritance-ui` experiment now gates only the indicators for that value: the dotted underline on an inherited label, and the dot that resets a local override ([#82840](https://github.com/WordPress/gutenberg/pull/82840)).
1814
- `TypographyPanel`: Setting a text color starts an unset link color tracking it whenever no link color is set on the block or inherited from Global Styles. Previously the link color was left alone ([#82840](https://github.com/WordPress/gutenberg/pull/82840)).
15+
- `LinkControl`, `LinkPicker`: migrate the link preview badges from the private `@wordpress/components` `Badge` to `@wordpress/ui` `Badge` ([#82684](https://github.com/WordPress/gutenberg/pull/82684)).
1916

2017
### Bug Fixes
2118

@@ -27,6 +24,7 @@
2724

2825
### Internal
2926

27+
- Remove the `crossorigin` MutationObserver. Under `Document-Isolation-Policy: isolate-and-credentialless` cross-origin resources load without the attribute, and adding it broke any resource served without CORS headers ([#82614](https://github.com/WordPress/gutenberg/pull/82614)).
3028
- Block bindings and variation transforms: Use the public `Menu` from `@wordpress/ui` instead of the private Components API. ([#81925](https://github.com/WordPress/gutenberg/pull/81925))
3129
- Layout hooks: Use `normalizeLegacyLayout` in `useLayoutClasses`, `useLayoutStyles`, the block layout styles wrapper and `isAxialBlockGapAllowed`, replacing four inline copies of the legacy `inherit` / size check ([#82710](https://github.com/WordPress/gutenberg/pull/82710)).
3230
- Extract the populated pattern category computation from `usePatternCategories` into a `getPopulatedCategories` util, and expose it and `searchItems` through private APIs for reuse by the start page options modal ([#81396](https://github.com/WordPress/gutenberg/pull/81396)).

0 commit comments

Comments
 (0)