Skip to content

Commit 245193a

Browse files
committed
Added Rector Workflow
1 parent a8dff2f commit 245193a

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/rector.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Rector CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- '*'
10+
11+
jobs:
12+
rector:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
# Checkout the code
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
20+
# Setup PHP environment
21+
- name: Set up PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: 8.3
25+
extensions: mbstring, xml, tokenizer, curl, json
26+
tools: composer
27+
coverage: none
28+
29+
# Cache dependencies
30+
- name: Cache Composer dependencies
31+
uses: actions/cache@v3
32+
with:
33+
path: vendor
34+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
35+
restore-keys: ${{ runner.os }}-composer-
36+
37+
# Install dependencies
38+
- name: Install dependencies
39+
run: composer install --no-progress --no-suggest --prefer-dist
40+
41+
# Cache Rector
42+
- name: Cache Rector cache
43+
uses: actions/cache@v3
44+
with:
45+
path: .rector/cache
46+
key: ${{ runner.os }}-rector-${{ hashFiles('**/rector.php') }}
47+
restore-keys: ${{ runner.os }}-rector-
48+
49+
# Run Rector
50+
- name: Run Rector
51+
run: |
52+
vendor/bin/rector process \
53+
--ansi
54+
55+
# Optional: Fail if Rector suggests changes
56+
- name: Validate Rector changes
57+
run: |
58+
git diff --exit-code

0 commit comments

Comments
 (0)