@@ -2,8 +2,6 @@ name: "Coding Standards"
2
2
3
3
on :
4
4
push :
5
- branches :
6
- tags :
7
5
pull_request :
8
6
9
7
env :
15
13
name : " phpcs"
16
14
runs-on : " ubuntu-22.04"
17
15
16
+ permissions :
17
+ # Give the default GITHUB_TOKEN write permission to commit and push the
18
+ # added or changed files to the repository.
19
+ contents : write
20
+
18
21
steps :
19
22
- name : " Checkout"
20
23
uses : " actions/checkout@v4"
50
53
with :
51
54
composer-options : " --no-suggest"
52
55
56
+ - name : " Format the code"
57
+ continue-on-error : true
58
+ run : |
59
+ mkdir .cache
60
+ ./vendor/bin/phpcbf
61
+
53
62
# The -q option is required until phpcs v4 is released
54
63
- name : " Run PHP_CodeSniffer"
55
64
run : " vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr"
65
+
66
+ - name : " Commit the changes"
67
+ uses : stefanzweifel/git-auto-commit-action@v5
68
+ with :
69
+ commit_message : " apply phpcbf formatting"
70
+
71
+ analysis :
72
+ runs-on : " ubuntu-22.04"
73
+ continue-on-error : true
74
+ strategy :
75
+ matrix :
76
+ php :
77
+ - ' 8.1'
78
+ - ' 8.2'
79
+ steps :
80
+ - name : Checkout
81
+ uses : actions/checkout@v4
82
+
83
+ - name : Setup PHP
84
+ uses : shivammathur/setup-php@v2
85
+ with :
86
+ php-version : ${{ matrix.php }}
87
+ extensions : curl, mbstring
88
+ tools : composer:v2
89
+ coverage : none
90
+
91
+ - name : Cache dependencies
92
+ id : composer-cache
93
+ uses : actions/cache@v3
94
+ with :
95
+ path : ./vendor
96
+ key : composer-${{ hashFiles('**/composer.lock') }}
97
+
98
+ - name : Install dependencies
99
+ run : composer install
100
+
101
+ - name : Restore cache PHPStan results
102
+ id : phpstan-cache-restore
103
+ uses : actions/cache/restore@v3
104
+ with :
105
+ path : .cache
106
+ key : " phpstan-result-cache-${{ github.run_id }}"
107
+ restore-keys : |
108
+ phpstan-result-cache-
109
+
110
+ - name : Run PHPStan
111
+ run : ./vendor/bin/phpstan analyse --no-interaction --no-progress --ansi
112
+
113
+ - name : Save cache PHPStan results
114
+ id : phpstan-cache-save
115
+ if : always()
116
+ uses : actions/cache/save@v3
117
+ with :
118
+ path : .cache
119
+ key : ${{ steps.phpstan-cache-restore.outputs.cache-primary-key }}
0 commit comments