Skip to content

Commit 7bd6f6f

Browse files
authored
adding workflow (#6)
1 parent 2b6161e commit 7bd6f6f

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

.github/workflows/php-cs-fixer.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: PHP CS Fixer
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: php-cs-fixer-${{ github.ref_name || github.run_id }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
15+
php-cs-fixer:
16+
name: PHP CS Fixer ${{ matrix.php }}
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
php: ['8.2']
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
with:
27+
fetch-depth: 1
28+
29+
- name: Set up PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php }}
33+
tools: cs2pr
34+
35+
- name: Install Composer dependencies
36+
uses: ramsey/composer-install@v2
37+
with:
38+
composer-options: "--no-progress --prefer-dist --optimize-autoloader"
39+
40+
- name: php-cs-fixer
41+
run: composer run style:check -- --format=checkstyle | cs2pr

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
}
6565
},
6666
"scripts": {
67-
"style:fix": "@php php-cs-fixer fix"
67+
"style:check": "@php ./vendor/bin/php-cs-fixer fix --dry-run",
68+
"style:fix": "@php ./vendor/bin/php-cs-fixer fix"
6869
}
6970
}

0 commit comments

Comments
 (0)