Skip to content

Commit 27697af

Browse files
jrfnlgrogy
authored andcommitted
GH Actions: report CS violations in the PR
The cs2pr tool will allow to display the results from an action run in checkstyle format in-line in the PR code view, which should improve usability of the workflow results. This implements this for the style check command. Includes switching the PHP version to PHP 7.4, as PHP 8.0 is not fully supported yet in PHP_CodeSniffer (full support expected in PHPCS 3.6.0). Ref: https://github.com/staabm/annotate-pull-request-from-checkstyle
1 parent 0f9f0ac commit 27697af

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/test.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
- name: Setup PHP
1818
uses: shivammathur/setup-php@v2
1919
with:
20-
php-version: '8.0'
21-
extensions: json
20+
php-version: '7.4'
2221
coverage: none
22+
tools: cs2pr
2323

2424
- name: Checkout code
2525
uses: actions/checkout@v2
@@ -28,7 +28,11 @@ jobs:
2828
uses: ramsey/composer-install@v1
2929

3030
- name: Run code sniffer
31-
run: vendor/bin/phpcs
31+
continue-on-error: true
32+
run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml
33+
34+
- name: Show PHPCS results in PR
35+
run: cs2pr ./phpcs-report.xml
3236

3337
bundle:
3438
name: Bundle binary

0 commit comments

Comments
 (0)