-
Notifications
You must be signed in to change notification settings - Fork 4
70 lines (56 loc) · 2.1 KB
/
php-cs-fixer.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Inspections
on:
pull_request:
branches:
- "*"
jobs:
runPHPCSInspection:
name: Run PHP CS fixer on changes
runs-on: ubuntu-latest
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
coverage: none
tools: cs2pr, composer:v2, phpcs, php-cs-fixer:3
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Create Database
run: touch database/database.sqlite
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install
- name: Set up Git credentials
run: |
echo "machine github.com" >> ~/.netrc
echo "login github-actions[bot]" >> ~/.netrc
echo "password ${{ secrets.AUTH_ACCESS_TOKEN }}" >> ~/.netrc
git config --global credential.helper 'store --file ~/.netrc'
- name: Detect changes
id: changes
run: |
URL="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files"
FILES=$(curl -s -X GET -G -n $URL | jq -r '.[] | .filename' | xargs)
echo "::set-output name=files::$FILES"
- name: Fix violations
run: php-cs-fixer fix ${{ steps.changes.outputs.files }} --config=.php-cs-fixer.dist.php
- name: Set up Git credentials
run: |
git config user.name "weBot"
git config user.email "[email protected]"
git config --global credential.helper store
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_ACCESS_TOKEN }}