-
Notifications
You must be signed in to change notification settings - Fork 2
54 lines (46 loc) · 1.42 KB
/
check-code-style.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
name: Check Code Style
on: push
jobs:
php-cs:
runs-on: ubuntu-latest
needs: what-has-changed
# Run only if PHP files have changed
if: ${{ needs.what-has-changed.outputs.php == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: dependencies-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: simplexml, tokenizer, xmlwriter
coverage: none
- name: Install dependencies
run: composer update --prefer-dist --no-interaction --no-suggest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Execute tests
run: ./vendor/bin/phpcs
# Job to check if certain files have changed
what-has-changed:
name: Detect file changes
runs-on: ubuntu-latest
outputs:
php: ${{ steps.filter.outputs.php }}
steps:
- name: Checkout
uses: actions/checkout@v3
# For pull requests it's not necessary to checkout the code
if: ${{ github.event_name != 'pull_request' }}
- uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ github.ref }}
filters: |
php:
- added|modified: 'src/**/*.php'