File tree 5 files changed +82
-4
lines changed
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
+
20
+
21
+ - name : " Install PHP with extensions"
22
+ uses :
" shivammathur/[email protected] "
23
+ with :
24
+ coverage : " none"
25
+ extensions : " simplexml"
26
+ php-version : " 7.0"
27
+
28
+ - name : " Cache dependencies installed with composer"
29
+
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 <[email protected] >
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 1
1
# Annotate a Pull Request based on a Checkstyle XML-report
2
2
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
+
3
5
Turns [ 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/ ) .
4
6
This script is meant for use within your GithubAction.
5
7
6
- That means you no longer search thru your GithubAction logfiles.
8
+ That means you no longer search thru your GithubAction logfiles.
7
9
No need to interpret messages which are formatted differently with every tool.
8
10
Instead you can focus on your Pull Request, and you don't need to leave the Pull Request area.
9
11
97
99
vendor/bin/phpstan analyse --error-format=checkstyle | vendor/bin/cs2pr
98
100
```
99
101
100
- # Resources
102
+ # Resources
101
103
102
104
[ GithubAction Problem Matchers] ( https://github.com/actions/toolkit/blob/master/docs/problem-matchers.md )
103
105
Original file line number Diff line number Diff line change 6
6
"ext-simplexml" : " *"
7
7
},
8
8
"require-dev" : {
9
- "phpunit/phpunit" : " ^7.0"
9
+ "phpunit/phpunit" : " ^7.0" ,
10
+ "friendsofphp/php-cs-fixer" : " ^2.16.1"
10
11
},
11
12
"authors" : [
12
13
{
13
14
"name" : " Markus Staab"
14
15
}
15
16
],
16
- "bin" : [" cs2pr" ]
17
+ "bin" : [" cs2pr" ],
18
+ "scripts" : {
19
+ "cs" : " php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --verbose"
20
+ }
17
21
}
You can’t perform that action at this time.
0 commit comments