forked from Torann/laravel-geoip
-
Notifications
You must be signed in to change notification settings - Fork 3
71 lines (59 loc) · 1.89 KB
/
php-coding-style.yml
File metadata and controls
71 lines (59 loc) · 1.89 KB
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
70
71
name: Code Style
on:
push:
branches: [main]
paths:
- '**.php'
- 'composer.json'
pull_request:
paths:
- '**.php'
- 'composer.json'
jobs:
fix:
name: Auto-fix code style
# Skip fork PRs — GITHUB_TOKEN can't push to external forks.
# Fork contributors: run `composer rector && composer cs` locally.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
token: ${{ github.token }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
coverage: none
- name: Install composer dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- name: Rector
run: composer rector
- name: PHP CS Fixer
run: composer cs
- name: Commit fixes
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: 'style: auto-fix (rector + php-cs-fixer)'
commit_author: 'GitHub Actions <actions@github.com>'
check:
name: Verify code style (forks)
# Only run the check job on fork PRs where we can't auto-fix.
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
coverage: none
- name: Install composer dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- name: Rector (dry-run)
run: composer rector:dry
- name: PHP CS check
run: composer cs:check