Skip to content

Commit 42cb2fa

Browse files
authored
Merge pull request #865 from Automattic/ci/add-php-lint-workflow
2 parents a35c378 + cf2329d commit 42cb2fa

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/php-lint.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: PHP Lint
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches-ignore:
7+
- develop
8+
- main
9+
10+
# Disable all permissions by default; grant minimal permissions per job
11+
permissions: {}
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
lint:
19+
name: PHP Syntax and Coding Standards
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
with:
28+
persist-credentials: false
29+
30+
- name: Setup PHP
31+
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # 2.32.0
32+
with:
33+
php-version: '8.2'
34+
tools: composer, cs2pr
35+
36+
- name: Install Composer dependencies
37+
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # 3.1.1
38+
with:
39+
composer-options: --prefer-dist --no-progress
40+
41+
- name: PHP syntax lint
42+
run: composer lint-ci | cs2pr
43+
44+
- name: PHP coding standards
45+
# continue-on-error until existing violations are addressed
46+
continue-on-error: true
47+
run: composer cs -- --report=checkstyle | cs2pr

0 commit comments

Comments
 (0)