Skip to content

Commit a4b20ca

Browse files
committed
Merge branch 'main' into feat-webhooks-admin-ui
2 parents 55cd087 + 7b210af commit a4b20ca

32 files changed

+723
-443
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: 'PHP Code Quality'
2+
description: 'Sets up PHP and runs code quality tools'
3+
inputs:
4+
working-directory:
5+
description: 'Directory to run composer and quality tools in'
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Setup PHP
11+
uses: shivammathur/setup-php@v2
12+
with:
13+
php-version: '7.4'
14+
tools: composer:v2
15+
coverage: none
16+
17+
- name: Install dependencies
18+
uses: ramsey/composer-install@v2
19+
with:
20+
working-directory: ${{ inputs.working-directory }}
21+
composer-options: "--no-progress"
22+
23+
- name: Run PHPStan
24+
working-directory: ${{ inputs.working-directory }}
25+
run: composer run-script phpstan
26+
shell: bash
27+
28+
- name: Run Psalm
29+
working-directory: ${{ inputs.working-directory }}
30+
run: composer run-script php:psalm
31+
shell: bash
32+
33+
- name: Run PHP CodeSniffer
34+
working-directory: ${{ inputs.working-directory }}
35+
run: composer run-script check-cs
36+
shell: bash
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: 'Create Plugin Artifact'
2+
description: 'Builds and uploads a plugin artifact for a PR if a plugin directory is modified.'
3+
inputs:
4+
slug:
5+
description: 'Plugin slug (directory name under plugins/)'
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Set up PHP
11+
uses: shivammathur/setup-php@v2
12+
with:
13+
php-version: '7.4'
14+
15+
- name: Install dependencies and build
16+
working-directory: plugins/${{ inputs.slug }}
17+
run: |
18+
composer install --no-dev --optimize-autoloader
19+
echo "${GITHUB_SHA}" > build-sha.txt
20+
rm -f plugin-build/${{ inputs.slug }}-*.zip
21+
composer archive -vvv --format=zip --file="plugin-build/${{ inputs.slug }}" --dir="."
22+
shell: bash
23+
24+
- name: Upload plugin artifact
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: ${{ inputs.slug }}
28+
path: plugins/${{ inputs.slug }}/plugin-build/*.zip

.github/workflows/code-quality.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Code Quality
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'plugins/**'
7+
8+
jobs:
9+
run:
10+
runs-on: ubuntu-latest
11+
name: Check code quality
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Get changed plugin directory
18+
id: plugin
19+
run: |
20+
git fetch --prune --unshallow
21+
plugin=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^plugins/' | head -1 | cut -d/ -f2)
22+
echo "slug=$plugin" >> $GITHUB_OUTPUT
23+
24+
- name: PHP Code Quality
25+
uses: ./.github/actions/code-quality
26+
with:
27+
working-directory: plugins/${{ steps.plugin.outputs.slug }}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Plugin Artifact for PR
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'plugins/**'
7+
8+
jobs:
9+
create-plugin-artifact:
10+
name: Create Plugin Artifact
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Get changed plugin directory
18+
id: plugin
19+
run: |
20+
git fetch --prune --unshallow
21+
plugin=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^plugins/' | head -1 | cut -d/ -f2)
22+
echo "slug=$plugin" >> $GITHUB_OUTPUT
23+
24+
- name: Create plugin artifact
25+
uses: ./.github/actions/create-plugin-artifact
26+
env:
27+
PLUGIN_SLUG: ${{ steps.plugin.outputs.slug }}
28+
with:
29+
slug: ${{ env.PLUGIN_SLUG }}
30+
31+
- name: Comment with artifact link
32+
uses: actions/github-script@v7
33+
env:
34+
PLUGIN_SLUG: ${{ steps.plugin.outputs.slug }}
35+
with:
36+
github-token: ${{ secrets.GITHUB_TOKEN }}
37+
script: |
38+
const pr = context.payload.pull_request;
39+
const runId = context.runId;
40+
const artifactUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}`;
41+
const slug = process.env.PLUGIN_SLUG;
42+
const body = `ℹ️ [Download the ${slug} plugin artifact from this workflow run](${artifactUrl}) (see the 'Artifacts' section at the bottom).`;
43+
await github.rest.issues.createComment({
44+
issue_number: pr.number,
45+
owner: context.repo.owner,
46+
repo: context.repo.repo,
47+
body
48+
});

plugins/hwp-previews/ACTIONS_AND_FILTERS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
- `hwp_previews_settings_group_settings_group` - Filter to modify the settings group name. Default is HWP_PREVIEWS_SETTINGS_GROUP
1717
- `hwp_previews_settings_group_settings_config` - Filter to modify the settings array. See `Settings_Group`
1818
- `hwp_previews_settings_group_cache_groups` - Filter to modify cache groups for `Settings_Group`
19-
- `hwp_preview_get_post_types_config` - Filter for generating the instance of `Post_Types_Config_Interface`
19+
- `hwp_previews_get_post_types_config` - Filter for generating the instance of `Post_Types_Config_Interface`
2020
- `hwp_previews_hooks_post_type_config` - Filter for post type config service for the Hook class
2121
- `hwp_previews_hooks_post_status_config` - Filter for post status config service for the Hook class
2222
- `hwp_previews_hooks_preview_link_service` - Filter for preview link service for the Hook class

plugins/hwp-previews/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# HWP Previews
2+
3+
## 0.0.1
4+
5+
- Proof of concept.

plugins/hwp-previews/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ Post statuses are `publish`, `future`, `draft`, `pending`, `private`, `auto-draf
6464
Navigate in WP Admin to **Settings › HWP Previews**. For each public post type, configure:
6565

6666
* **Enable HWP Previews** – Master switch
67-
* **Unique Post Slugs** – Force unique slugs for all post statuses in the post status config.
6867
* **Allow All Statuses as Parent** – (Hierarchical types only)
6968
* **Preview URL Template** – Custom URL with tokens like `{ID}`, `{slug}`
7069
* **Load Previews in Iframe** – Toggle iframe-based preview rendering

plugins/hwp-previews/composer.json

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,27 @@
5050
}
5151
},
5252
"archive": {
53+
"name": "hwp-previews",
5354
"exclude": [
54-
"vendor/",
55-
"phpcs/",
56-
"phpstan/",
57-
".gitignore",
58-
".editorconfig",
59-
"composer.json",
60-
"composer.lock",
61-
"*.xml",
62-
"*.dist",
63-
"*.md"
55+
"/.*",
56+
"bin",
57+
"docker",
58+
"docs",
59+
"phpstan",
60+
"phpcs",
61+
"plugin-build",
62+
"tests",
63+
"!vendor",
64+
"!vendor-prefixed",
65+
"/docker-compose.yml",
66+
"/phpstan.neon.dist",
67+
"/psalm.xml",
68+
"/phpcs.xml",
69+
"/ACTIONS_AND_FILTERS.md",
70+
"/phpcs-cache.json",
71+
"/Thumbs.db",
72+
"/auth.json",
73+
"/.DS_Store"
6474
]
6575
},
6676
"autoload": {
@@ -90,9 +100,9 @@
90100
"phpstan": [
91101
"vendor/bin/phpstan analyze --ansi --memory-limit=1G"
92102
],
93-
"psalm": [
94-
"vendor/bin/psalm --no-progress --show-info=false"
95-
]
103+
"php:psalm": "psalm",
104+
"php:psalm:info": "psalm --show-info=true",
105+
"php:psalm:fix": "psalm --alter"
96106
},
97107
"scripts-descriptions": {
98108
},

plugins/hwp-previews/composer.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/hwp-previews/docs/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)