Repository navigation
79 lines (66 loc) · 2.67 KB
/
Copy pathfix-php-code-style-issues.yml
File metadata and controls
79 lines (66 loc) · 2.67 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
72
73
74
75
76
77
78
79
name: Fix PHP code style issues
on:
pull_request:
paths:
- '**.php'
- 'pint.json'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
php-code-styling:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ github.head_ref }}
# NOT aglipanci/laravel-pint-action with `configPath: pint.json`. This
# package ships no pint.json, and Pint handed a config path that does not
# exist falls back to its OWN defaults and exits 0 rather than failing. So
# this job was rewriting the code to Pint's defaults and committing that -
# while `composer pint` checks the shared laranail config. The two
# disagreed, and this one won because it pushes.
- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: '8.5'
coverage: none
- name: Resolve composer cache directory
id: composer-cache
shell: bash
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Restore composer cache
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
restore-keys: composer-${{ runner.os }}-${{ matrix.php }}-
- name: Drop cached laranail archives
# laranail/* resolve through a single MOVING v0.1.0 tag, so composer's dist
# cache is keyed on a name whose contents change underneath it. A restored
# archive is then silently stale: the install reports success and unpacks
# whatever was cached the first time. Everything else is immutable per
# version and stays cached.
# POSIX command via bash: Windows runners default to PowerShell, where this
# would be a parse error rather than a no-op.
shell: bash
run: rm -rf "$(composer config cache-files-dir)/laranail"
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Fix PHP code style issues
run: composer pint-fix
- name: Pull latest changes
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
git stash
git pull --rebase origin "$BRANCH"
git stash pop || true
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@d0b01107b5db882071f96de5dd4b54961ea93f4c # v7.2.1
with:
commit_message: 'chore: pint'