-
Notifications
You must be signed in to change notification settings - Fork 257
49 lines (48 loc) · 1.7 KB
/
phpcs.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
name: Run PHPCS
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- name: Get file changes
id: get_file_changes
uses: tj-actions/changed-files@v44
- name: PHPCBF
if: steps.get_file_changes.outputs.any_changed == 'true' && github.event_name == 'push'
env:
ALL_CHANGED_FILES: ${{ steps.get_file_changes.outputs.all_changed_files }}
run: |
echo "Running PHPCBF on the following files:"
echo "${ALL_CHANGED_FILES}"
./vendor/bin/phpcbf ${ALL_CHANGED_FILES}
continue-on-error: true
- name: Commit files
if: github.event_name == 'push'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git status
git diff-index --quiet HEAD || (git commit -m "Auto Commit - phpcbf" -a --no-verify)
- name: Push changes
if: github.event_name == 'push'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: PHPCS check
if: steps.get_file_changes.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.get_file_changes.outputs.all_changed_files }}
run: |
echo "Running PHPCS on the following files:"
echo "${ALL_CHANGED_FILES}"
./vendor/bin/phpcs ${ALL_CHANGED_FILES}