forked from elementor/elementor
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (45 loc) · 1.57 KB
/
lint-php-changes-only.yml
File metadata and controls
49 lines (45 loc) · 1.57 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
name: Lint-PHP-Changes-Only
on:
pull_request:
merge_group:
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
php-file-diff:
runs-on: ubuntu-22.04
name: PHP Linter - File Diff
if: startsWith( github.repository, 'elementor/' )
permissions:
pull-requests: read
outputs:
any_changed: ${{ steps.changed-php-files.outputs.any_changed }}
all_changed_files: ${{ steps.changed-php-files.outputs.all_changed_files }}
steps:
- name: Get all changed PHP files
id: changed-php-files
uses: tj-actions/changed-files@v45
with:
files: |
**.php
PHP-Linter:
runs-on: ubuntu-22.04
needs: [ 'php-file-diff' ]
if: ${{ needs.php-file-diff.outputs.any_changed == 'true' || github.event.pull_request.title == null }}
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Setup PHP 8.1
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
- name: Install Dependencies
run: |
composer install
- name: Run PHP Linter
env:
PHP_CHANGED_FILES: ${{ needs.php-file-diff.outputs.all_changed_files }}
run: |
#composer lint $(echo "${PHP_CHANGED_FILES}" | tr '\n' ' ')
vendor/bin/phpcs --extensions=php --standard=./ruleset.xml --warning-severity=0 $(echo "${PHP_CHANGED_FILES}" | tr '\n' ' ')