Skip to content

Update existing content #682

Update existing content

Update existing content #682

name: Update existing content
on:
workflow_dispatch:
push:
branches: [trunk]
permissions:
contents: write
pull-requests: write
jobs:
content-update:
if: github.repository_owner == 'WordPress'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: trunk
- name: Setup
uses: WordPress/wporg-repo-tools/.github/actions/setup@trunk
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the content update
id: build-patterns
run: |
chmod -R ugo+w source/wp-content/themes/wporg-main-2022/
yarn wp-env start
yarn setup:wp
yarn build:patterns
mkdir "$GITHUB_WORKSPACE/artifacts/"
git diff --name-only source/wp-content/themes/wporg-main-2022/**/*.php
{
echo 'changelist<<EOF'
git diff --name-only source/wp-content/themes/wporg-main-2022/**/*.php | xargs yarn --silent screenshot-changes
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Upload screenshots
id: upload-artifact
uses: actions/upload-artifact@v4
with:
name: screenshot-artifacts
path: "${{ github.workspace }}/artifacts/"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
branch: automated/content-update
delete-branch: true
add-paths: source/wp-content/themes/wporg-main-2022/**/*.php
title: 'Content updates from Page Editor'
commit-message: '[automated] Sync content from Page Editor.'
body: |
The following pages have been updated in the Page Editor.
```
${{ steps.build-patterns.outputs.changelist }}
```
Screenshots: ${{ steps.upload-artifact.outputs.artifact-url }}
Please review, merge, and deploy.