-
Notifications
You must be signed in to change notification settings - Fork 26
64 lines (56 loc) · 1.97 KB
/
content-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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.