Skip to content

Commit

Permalink
Merge branch 'trunk' into try/canonical-block-plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
creativecoder committed Jun 25, 2024
2 parents 50a9c50 + d97e3f7 commit 5f9d0d8
Show file tree
Hide file tree
Showing 270 changed files with 40,015 additions and 37,165 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@
*.jpg binary
*.png binary
*.ttf binary

# Directories with vendored code.
packages/edit-site/lib/** linguist-vendored

# The changelog.txt file is authored as markdown.
changelog.txt linguist-language=Markdown
2 changes: 2 additions & 0 deletions .github/workflows/check-backport-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Verify Core Backport Changlog
on:
pull_request:
types: [opened, synchronize, labeled, unlabeled]
branches:
- trunk
paths:
- 'lib/**'
- '!lib/load.php'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/check-components-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: OPTIONAL - Verify @wordpress/components CHANGELOG update
on:
pull_request:
types: [opened, synchronize]
branches:
- trunk
paths:
- 'packages/components/**'
- '!packages/components/src/**/stories/**'
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ build
build-module
build-types
packages/block-serialization-spec-parser/parser.js
packages/edit-site/lib
packages/react-native-editor/bundle
packages/url/src/test/fixtures
vendor
10 changes: 9 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
// Import the default config file and expose it in the project root.
// Useful for editor integrations.
module.exports = require( '@wordpress/prettier-config' );
module.exports = {
...require( '@wordpress/prettier-config' ),
overrides: [
{
files: [ 'changelog.txt' ],
options: { parser: 'markdown' },
},
],
};
3 changes: 3 additions & 0 deletions backport-changelog/6.6/6841.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/6841

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

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

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

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

* https://github.com/WordPress/gutenberg/pull/62712
24 changes: 19 additions & 5 deletions bin/cherry-pick.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import readline from 'readline';

import { spawnSync } from 'node:child_process';

const REPO = 'WordPress/gutenberg';
const LABEL = process.argv[ 2 ] || 'Backport to WP Beta/RC';
const BACKPORT_COMPLETED_LABEL = 'Backported to WP Core';
const BRANCH = getCurrentBranch();
Expand Down Expand Up @@ -113,7 +114,7 @@ function cli( command, args, pipe = false ) {
*/
async function fetchPRs() {
const { items } = await GitHubFetch(
`/search/issues?per_page=100&q=is:pr state:closed sort:updated label:"${ LABEL }" repo:WordPress/gutenberg`
`/search/issues?per_page=100&q=is:pr state:closed sort:updated label:"${ LABEL }" repo:${ REPO }`
);
const PRs = items
// eslint-disable-next-line camelcase
Expand Down Expand Up @@ -143,7 +144,7 @@ async function fetchPRs() {
const PRsWithMergeCommit = [];
for ( const PR of PRs ) {
const { merge_commit_sha: mergeCommitHash } = await GitHubFetch(
'/repos/WordPress/Gutenberg/pulls/' + PR.number
`/repos/${ REPO }/pulls/` + PR.number
);
PRsWithMergeCommit.push( {
...PR,
Expand All @@ -170,14 +171,25 @@ async function fetchPRs() {
* @return {Promise<Object>} Parsed response JSON.
*/
async function GitHubFetch( path ) {
const token = getGitHubAuthToken();
const response = await fetch( 'https://api.github.com' + path, {
headers: {
Accept: 'application/vnd.github.v3+json',
Authorization: `Bearer ${ token }`,
},
} );
return await response.json();
}

/**
* Retrieves the GitHub authentication token using `gh auth token`.
*
* @return {string} The GitHub authentication token.
*/
function getGitHubAuthToken() {
return cli( 'gh', [ 'auth', 'token' ] );
}

/**
* Attempts to cherry-pick given PRs using `git` CLI command.
*
Expand Down Expand Up @@ -369,15 +381,17 @@ function reportSummaryNextSteps( successes, failures ) {
function GHcommentAndRemoveLabel( pr ) {
const { number, cherryPickHash } = pr;
const comment = prComment( cherryPickHash );
const repo = [ '--repo', REPO ];
try {
cli( 'gh', [ 'pr', 'comment', number, '--body', comment ] );
cli( 'gh', [ 'pr', 'edit', number, '--remove-label', LABEL ] );
cli( 'gh', [ 'pr', 'comment', number, ...repo, '--body', comment ] );
cli( 'gh', [ 'pr', 'edit', number, ...repo, '--remove-label', LABEL ] );

if ( LABEL === 'Backport to WP Beta/RC' ) {
cli( 'gh', [
'pr',
'edit',
number,
...repo,
'--add-label',
BACKPORT_COMPLETED_LABEL,
] );
Expand Down Expand Up @@ -433,7 +447,7 @@ function reportFailure( { number, title, error, mergeCommitHash } ) {
* @return {string} PR URL.
*/
function prUrl( number ) {
return `https://github.com/WordPress/gutenberg/pull/${ number } `;
return `https://github.com/${ REPO }/pull/${ number } `;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions bin/plugin/commands/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -961,9 +961,9 @@ function getContributorProps( pullRequests ) {
}

return (
'## First time contributors' +
'## First-time contributors' +
'\n\n' +
'The following PRs were merged by first time contributors:' +
'The following PRs were merged by first-time contributors:' +
'\n\n' +
contributorsList
);
Expand Down
2 changes: 1 addition & 1 deletion bin/plugin/commands/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function calculateVersionBumpFromChangelog(
let changesDetected = false;
let versionBump = null;
for ( const line of lines ) {
const lineNormalized = line.toLowerCase().trimLeft();
const lineNormalized = line.toLowerCase().trimStart();
// Detect unpublished changes first.
if ( lineNormalized.startsWith( '## unreleased' ) ) {
changesDetected = true;
Expand Down
4 changes: 2 additions & 2 deletions bin/plugin/commands/test/__snapshots__/changelog.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ The following contributors merged PRs in this release:
`;

exports[`getContributorProps verify that the contributors props are properly formatted 1`] = `
"## First time contributors
"## First-time contributors
The following PRs were merged by first time contributors:
The following PRs were merged by first-time contributors:
- @leemyongpakvn: Fix a broken MD link in callout. ([54772](https://github.com/WordPress/gutenberg/pull/54772))
"
Expand Down
Loading

0 comments on commit 5f9d0d8

Please sign in to comment.