-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (41 loc) · 1.84 KB
/
cscheck.yml
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
43
44
45
46
47
48
49
50
51
name: Check CS
on:
push:
pull_request_target:
jobs:
build:
runs-on: ubuntu-latest
name: Check code style
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 10
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "7.4"
tools: cs2pr
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies installed with composer
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}
restore-keys: php-${{ matrix.php-version }}-composer-locked-
- name: Install dependencies with composer
run: composer update --no-interaction --no-progress --no-suggest
- if: ${{ github.base_ref == '' }}
run: composer cscheck
- name: Install git-phpcs
if: ${{ github.base_ref != '' }}
run: wget https://github.com/diff-sniffer/diff-sniffer/releases/download/0.5.1/diff-sniffer.phar
- name: Fetch head branch
if: ${{ github.base_ref != '' }}
run: git remote set-branches --add origin $GITHUB_BASE_REF && git fetch origin $GITHUB_BASE_REF
- name: Run diff-sniffer
if: ${{ github.base_ref != '' }}
run: php diff-sniffer.phar origin/$GITHUB_BASE_REF...$GITHUB_SHA --report=checkstyle --standard=Solido src/ | cs2pr