WordPress / wporg-main-2022

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

Add details to the automated content update PR #467

Closed ryelle closed 1 month ago

ryelle commented 1 month ago

I was aiming to add screenshots & other context to the content update PRs (e.g., https://github.com/WordPress/wporg-main-2022/pull/464), as I've found myself needing to reply with comments describing the changes and/or linking off to relevant issues (when these exist, this is easier 🙂)

This PR is adds a changed-page list & link to screenshots to the automatically-created PR. The screenshots are added as a link to the action's artifacts file, which is a zip file with full-screen screenshots of the changed pages. Changed pages are detected by updates to the pattern files, which are looked up using the manifest.json to get the page slug. The slug is then used to fetch page data from the wp.org REST API, which is how we get the title & permalink.

If there are multiple pages changed, they should all appear in the list, and all screenshots will be in the download.

(Note that this won't work with the 6.6 release page, since the pattern is currently set to the "in progress" pattern #463, it will only show the placeholder pattern.)

Screenshots

Screenshot 2024-07-08 at 5 41 02 PM

https://github.com/ryelle/wporg-main-2022/pull/1

How to test the changes in this Pull Request:

I tested it on my own fork, changing the action to if: github.repository_owner == 'ryelle', & making a change to one of the pattern files. That way, when the automated action runs, it sees the "change" and creates a PR.

You can also test the screenshot command by running yarn screenshot-changes source/wp-content/themes/wporg-main-2022/patterns/about.php (or any other pattern files). Make sure to run yarn first to get the new puppeteer dependency.

ryelle commented 1 month ago

The only way I could see that we could achieve that would be to commit them to a specific git branch (which has no code history, just the images) and inline those instead.

Yeah, that could work - maybe a future improvement :)