Skip to content

Commit 5e7c02c

Browse files
committed
fix php version in github style fixer
1 parent 91cccc4 commit 5e7c02c

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

.github/workflows/code-style.yml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,54 @@ name: Code style
33
on: [push, pull_request]
44

55
permissions:
6-
contents: read
6+
contents: read # Allows checkout
77

88
jobs:
99
phpcs:
1010
name: PHPCS
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v3
13+
- name: Checkout code
14+
uses: actions/checkout@v4 # Use latest major version
1515

1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
1919
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
24+
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
32+
with:
33+
path: ${{ steps.composer-cache.outputs.dir }}
34+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
35+
restore-keys: |
36+
${{ runner.os }}-composer-
2037
2138
- name: Install dependencies
22-
run: composer update --prefer-dist --no-progress --no-suggest
39+
run: composer install --prefer-dist --no-progress --no-interaction # Use install, add --no-interaction for CI
40+
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!
2353

24-
- name: Run script
25-
run: vendor/bin/phpcs
54+
# Option 3: Most basic run (relies heavily on defaults - least recommended)
55+
# - name: Run PHPCS (basic)
56+
# run: vendor/bin/phpcs

0 commit comments

Comments
 (0)