-
Notifications
You must be signed in to change notification settings - Fork 2
73 lines (60 loc) · 1.78 KB
/
php-cs-fixer.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: PHP CS Fixer
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
name: Check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- "8.3"
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php }}
- name: Restore Composer package cache
id: composer-cache
uses: actions/cache@v3
with:
path: "~/.cache/composer"
key: "php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php }}-composer-"
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --ignore-platform-reqs
codestyle:
name: Code Style checks
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Setup PHP and tools
uses: shivammathur/[email protected]
with:
php-version: 8.3
tools: php-cs-fixer:3.65
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout main branch
run: |
git fetch origin
git checkout main || git checkout -b main origin/main
- name: Run PHP-CS-Fixer
run: php-cs-fixer fix --diff --ansi
- name: Commit changes
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add .
git commit -m "Apply PHP CS Fixer changes" || echo "No changes to commit"
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main