-
Notifications
You must be signed in to change notification settings - Fork 15
35 lines (28 loc) · 917 Bytes
/
Copy pathwp-plugin-ci.yml
File metadata and controls
35 lines (28 loc) · 917 Bytes
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
name: CI Diff Only
on:
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:
jobs:
phpcs:
name: PHP CodeSniffer
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# Fetch all history so we can diff.
fetch-depth: 0
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none
tools: cs2pr
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
- name: Run PHPCS on changed files
run: |
touch $GITHUB_WORKSPACE/tmp.php
export CHANGED_FILES=$(git diff --name-only --diff-filter=AM remotes/origin/${{ github.base_ref }} | tr '\n' ' ')
vendor/bin/phpcs -q -n --ignore=vendor --standard=WordPress --report=checkstyle $GITHUB_WORKSPACE/tmp.php $(echo $CHANGED_FILES) | cs2pr