-
Notifications
You must be signed in to change notification settings - Fork 40
42 lines (36 loc) · 1.49 KB
/
phpcs.yml
File metadata and controls
42 lines (36 loc) · 1.49 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
name: PHPCS Check
on:
pull_request_target:
paths:
- '**/*.php' # Run only when PHP files change
# Concurrency: Ensure only one instance of this workflow runs per pull request or commit.
# If a new workflow for the same pull request/commit is triggered, the previous one will be canceled.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
phpcs:
name: PHPCS Check
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code from the pull request base branch to ensure we're analyzing the correct changes.
- name: Checkout code
uses: actions/checkout@v3
with:
# checkout the PR branch, not the base
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0 # ensures full history
# Step 2: Set up PHP 7.4 with necessary configurations. Also, install the "cs2pr" tool for converting PHPCS output into annotations.
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
ini-values: 'memory_limit=1G'
coverage: none
tools: cs2pr
# Step 3: Install all required Composer dependencies for the project.
- name: Install Composer dependencies
run: composer install
# Step 4: Run the PHPCS check using the "composer phpcs" command to detect coding standard violations.
- name: Run PHPCS checks
run: composer phpcs