WordPress / wporg-main-2022

A block-based child theme for WordPress.org, plus local environment
68 stars 26 forks source link

Streamline content updates, by automating PRs for content updates #391

Closed dd32 closed 7 months ago

dd32 commented 7 months ago

Currently the process for updating an existing page is to..

This PR reduces the process and removes the requirement for the merger to have a local working environment.

With this change the flow is:

There's a very slight change in the process there, but notably it doesn't require a local environment for basic text-only updates.

This could be improved by..

For an example of the generated PR, see https://github.com/dd32/wporg-main-2022/pull/1

As this flow is becoming more used, this could be made as a generic action imported from https://github.com/wordpress/wporg-repo-tools/ once confirmed working and acceptable.

Edit: Just noting that this includes a fix for the upstream mariadb+wp-env issue; this can be removed before merge, we'll need to separately update the wp-env package or wait for the upstream mariadb docker image to update, before this will work without it.

dd32 commented 7 months ago

Perhaps the most important change here, is that it'd create a ticket queue of "Hey, there's been a content update by someone, review and deploy" without needing to have the editor contact a meta developer to sync.

ryelle commented 7 months ago

I really like this idea, but I think we need to tweak some things in the parser before auto-applying the synced changes. When I sync patterns, I usually end up manually adjusting the changeset slightly before committing.

For example, looking at https://github.com/dd32/wporg-main-2022/pull/1/files

dd32 commented 7 months ago

@ryelle I totally agree, I was surprised to see some of these changes included, but if the parser needs to be updated to ignore some content, we should do that, to avoid needing us to pick and choose which changes.

dd32 commented 7 months ago

I've pushed two changes to the parsers:

The example PR now reflects that, so here's what was initially included: core/embed paragraph
Screenshot 2024-02-22 at 12 19 09 pm Screenshot 2024-02-22 at 12 19 01 pm

These were the two parser related changes noted above, the ref items are still there in the wp:navigation blocks, I suspect that would need to be removed from the API that exposes these blocks rather than being done within this block parser? But we can probably add another transformation specifically for <!-- wp:navigation .+ --> to remove attributes as needed.

dd32 commented 7 months ago

I expect iteration will be required on the PR content, but merging for now to finalise testing.

dd32 commented 7 months ago

I've setup a task on WordPress.org/ to initiate a run of this workflow 5 minutes after a page edit occurs.

That's in /mu-plugins/main-network/site-main.php r21715-dotorg.

Why 5 minutes? There needed to be some kind of rate limiting, this seemed short enough.

Example run: https://github.com/WordPress/wporg-main-2022/actions/runs/8015893967