-
-
Notifications
You must be signed in to change notification settings - Fork 32
68 lines (56 loc) · 1.82 KB
/
Copy pathcs.yml
File metadata and controls
68 lines (56 loc) · 1.82 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Code Style
on:
pull_request:
paths:
- 'public/**'
- 'src/**'
- 'config/**'
- 'tests/**'
- '.php-cs-fixer.php'
- 'rector.php'
- 'composer.json'
- 'yii'
- 'yii.bat'
- '.github/workflows/cs.yml'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
cs-fix:
name: PHP CS Fixer and Rector
runs-on: ubuntu-latest
permissions:
contents: write # Required to push automated CS fixes to the pull request branch.
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: 8.2
tools: composer:v2
coverage: none
- name: Install Composer dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
- name: Run PHP CS Fixer
run: ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php
- name: Run Rector
run: ./vendor/bin/rector --output-format=github
- name: Configure Git credentials
env:
GH_TOKEN: ${{ github.token }}
run: git config --global credential.helper '!f() { echo username=x-access-token; echo password=$GH_TOKEN; }; f'
- name: Commit changes
run: |
git add -- '*.php'
if git diff --cached --quiet; then
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "Apply PHP CS Fixer and Rector changes (CI)"
git push