-
Notifications
You must be signed in to change notification settings - Fork 2
77 lines (70 loc) · 2.13 KB
/
plugin-check.yml
File metadata and controls
77 lines (70 loc) · 2.13 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
# Runs WordPress Plugin Check on modified plugins to ensure compliance with
# WordPress.org guidelines and coding standards.
#
# https://wordpress.org/plugins/plugin-check/
name: Plugin Check
on:
push:
branches:
- main
paths:
- 'plugins/**'
pull_request:
branches:
- main
paths:
- 'plugins/**'
jobs:
detect-plugins:
runs-on: ubuntu-latest
name: Detect modified plugins
outputs:
plugins: ${{ steps.detect.outputs.plugins }}
has-plugins: ${{ steps.detect.outputs.has-plugins }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get changed plugin directories
id: plugin
run: |
if [ "${{ github.event_name }}" = "push" ]; then
bash .github/scripts/get_plugin_slug.sh main
else
bash .github/scripts/get_plugin_slug.sh \
${{ github.event.pull_request.base.sha }} \
${{ github.event.pull_request.head.sha }}
fi
- name: Set output
id: detect
run: |
# get_plugin_slug.sh outputs: slug, plugins (JSON array), has-plugins
if [ -z "${{ steps.plugin.outputs.slug }}" ]; then
echo "plugins=[]" >> $GITHUB_OUTPUT
echo "has-plugins=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "plugins=${{ steps.plugin.outputs.plugins }}" >> $GITHUB_OUTPUT
echo "has-plugins=${{ steps.plugin.outputs.has-plugins }}" >> $GITHUB_OUTPUT
plugin-check:
needs: detect-plugins
if: needs.detect-plugins.outputs.has-plugins == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
plugin: ${{ fromJson(needs.detect-plugins.outputs.plugins) }}
fail-fast: false
name: ${{ matrix.plugin }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Plugin Check
uses: wordpress/plugin-check-action@v1
with:
build-dir: plugins/${{ matrix.plugin }}
exclude-directories: |
.git
vendor
node_modules
tests
ignore-warnings: true
include-experimental: false