|
1 |
| -name: Code style |
| 1 | +name: Check & fix styling |
2 | 2 |
|
3 |
| -on: [push, pull_request] |
4 |
| - |
5 |
| -permissions: |
6 |
| - contents: read # Allows checkout |
| 3 | +on: [push] |
7 | 4 |
|
8 | 5 | jobs:
|
9 |
| - phpcs: |
10 |
| - name: PHPCS |
| 6 | + php-cs-fixer: |
11 | 7 | runs-on: ubuntu-latest
|
| 8 | + |
12 | 9 | steps:
|
13 | 10 | - name: Checkout code
|
14 |
| - uses: actions/checkout@v4 # Use latest major version |
15 |
| - |
16 |
| - - name: Setup PHP |
17 |
| - uses: shivammathur/setup-php@v2 |
| 11 | + uses: actions/checkout@v4 |
18 | 12 | with:
|
19 |
| - php-version: '8.2' |
20 |
| - extensions: mbstring, xml # Add common extensions often needed by linters/tools |
21 |
| - tools: composer:v2 # Optionally specify composer version |
22 |
| - env: |
23 |
| - COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Recommended for private repos or hitting rate limits |
| 13 | + ref: ${{ github.head_ref }} |
24 | 14 |
|
25 |
| - - name: Get Composer Cache Directory |
26 |
| - id: composer-cache |
27 |
| - run: | |
28 |
| - echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
29 |
| -
|
30 |
| - - name: Cache Composer dependencies |
31 |
| - uses: actions/cache@v4 # Use latest major version |
| 15 | + - name: Run PHP CS Fixer |
| 16 | + uses: docker://oskarstark/php-cs-fixer-ga |
32 | 17 | with:
|
33 |
| - path: ${{ steps.composer-cache.outputs.dir }} |
34 |
| - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
35 |
| - restore-keys: | |
36 |
| - ${{ runner.os }}-composer- |
37 |
| -
|
38 |
| - - name: Install dependencies |
39 |
| - run: composer install --prefer-dist --no-progress --no-interaction # Use install, add --no-interaction for CI |
| 18 | + args: --config=.php_cs.dist.php --allow-risky=yes |
40 | 19 |
|
41 |
| - # --- IMPORTANT --- |
42 |
| - # Choose ONE of the following 'Run PHPCS' steps based on your project setup: |
43 |
| - |
44 |
| - # Option 1: If you have a phpcs.xml or phpcs.xml.dist file in your root |
45 |
| - - name: Run PHPCS (using config file) |
46 |
| - run: vendor/bin/phpcs --standard=phpcs.xml.dist # Or phpcs.xml if that's your filename |
47 |
| - # Optional: Specify paths explicitly if needed: |
48 |
| - # run: vendor/bin/phpcs --standard=phpcs.xml.dist ./src ./tests |
49 |
| - |
50 |
| - # Option 2: If you DON'T have a config file and want to use a standard (e.g., PSR12) |
51 |
| - # - name: Run PHPCS (using PSR12 standard) |
52 |
| - # run: vendor/bin/phpcs --standard=PSR12 ./src ./tests # Adjust paths (./src ./tests) as needed! |
53 |
| - |
54 |
| - # Option 3: Most basic run (relies heavily on defaults - least recommended) |
55 |
| - # - name: Run PHPCS (basic) |
56 |
| - # run: vendor/bin/phpcs |
| 20 | + - name: Commit changes |
| 21 | + uses: stefanzweifel/git-auto-commit-action@v5 |
| 22 | + with: |
| 23 | + commit_message: Fix styling |
0 commit comments