File tree Expand file tree Collapse file tree 5 files changed +82
-4
lines changed
Expand file tree Collapse file tree 5 files changed +82
-4
lines changed Original file line number Diff line number Diff line change 1+ # https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+ name : " Continuous Integration"
4+
5+ on :
6+ pull_request :
7+ push :
8+ branches :
9+ - " master"
10+
11+ jobs :
12+ coding-standards :
13+ name : " Coding Standards"
14+
15+ runs-on : " ubuntu-latest"
16+
17+ steps :
18+ - name : " Checkout"
19+ uses : " actions/checkout@v2.0.0"
20+
21+ - name : " Install PHP with extensions"
22+ uses : " shivammathur/setup-php@1.8.1"
23+ with :
24+ coverage : " none"
25+ extensions : " simplexml"
26+ php-version : " 7.0"
27+
28+ - name : " Cache dependencies installed with composer"
29+ uses : " actions/cache@v1.0.3"
30+ with :
31+ path : " ~/.composer/cache"
32+ key : " php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
33+ restore-keys : " php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
34+
35+ - name : " Install dependencies with composer"
36+ run : " composer install --no-interaction --no-progress --no-suggest"
37+
38+ - name : " Run friendsofphp/php-cs-fixer"
39+ run : " vendor/bin/php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --dry-run --verbose"
Original file line number Diff line number Diff line change 1+ vendor /
2+ .php_cs.cache
3+ composer.lock
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ $ header = <<<'EOF'
6+ Turns checkstyle based XML-Reports into Github Pull Request Annotations via the Checks API. This script is meant for use within your GithubAction.
7+
8+ (c) Markus Staab <markus.staab@redaxo.org>
9+
10+ For the full copyright and license information, please view the LICENSE
11+ file that was distributed with this source code.
12+
13+ https://github.com/staabm/annotate-pull-request-from-checkstyle
14+ EOF;
15+
16+ $ finder = PhpCsFixer \Finder::create ()
17+ ->files ()
18+ ->in (__DIR__ )
19+ ->name ('cs2pr ' );
20+
21+ return PhpCsFixer \Config::create ()
22+ ->setFinder ($ finder )
23+ ->setRules ([
24+ 'header_comment ' => [
25+ 'commentType ' => 'comment ' ,
26+ 'header ' => $ header ,
27+ 'location ' => 'after_declare_strict ' ,
28+ 'separate ' => 'both ' ,
29+ ]
30+ ]);
Original file line number Diff line number Diff line change 11# Annotate a Pull Request based on a Checkstyle XML-report
22
3+ [ ![ Continuous Integration] ( https://github.com/staabm/annotate-pull-request-from-checkstyle/workflows/Continuous%20Integration/badge.svg )] ( https://github.com/staabm/annotate-pull-request-from-checkstyle/actions )
4+
35Turns [ checkstyle based XML-Reports] ( https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/checkstyle.xsd ) into Github Pull Request [ Annotations via the Checks API] ( https://developer.github.com/v3/checks/ ) .
46This script is meant for use within your GithubAction.
57
6- That means you no longer search thru your GithubAction logfiles.
8+ That means you no longer search thru your GithubAction logfiles.
79No need to interpret messages which are formatted differently with every tool.
810Instead you can focus on your Pull Request, and you don't need to leave the Pull Request area.
911
9799 vendor/bin/phpstan analyse --error-format=checkstyle | vendor/bin/cs2pr
98100```
99101
100- # Resources
102+ # Resources
101103
102104[ GithubAction Problem Matchers] ( https://github.com/actions/toolkit/blob/master/docs/problem-matchers.md )
103105
Original file line number Diff line number Diff line change 66 "ext-simplexml" : " *"
77 },
88 "require-dev" : {
9- "phpunit/phpunit" : " ^7.0"
9+ "phpunit/phpunit" : " ^7.0" ,
10+ "friendsofphp/php-cs-fixer" : " ^2.16.1"
1011 },
1112 "authors" : [
1213 {
1314 "name" : " Markus Staab"
1415 }
1516 ],
16- "bin" : [" cs2pr" ]
17+ "bin" : [" cs2pr" ],
18+ "scripts" : {
19+ "cs" : " php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --verbose"
20+ }
1721}
You can’t perform that action at this time.
0 commit comments