Skip to content

Commit

Permalink
Added Rector Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nasrulhazim committed Dec 11, 2024
1 parent a8dff2f commit 245193a
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/rector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Rector CI

on:
push:
branches:
- main
pull_request:
branches:
- '*'

jobs:
rector:
runs-on: ubuntu-latest

steps:
# Checkout the code
- name: Checkout repository
uses: actions/checkout@v3

# Setup PHP environment
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: mbstring, xml, tokenizer, curl, json
tools: composer
coverage: none

# Cache dependencies
- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

# Install dependencies
- name: Install dependencies
run: composer install --no-progress --no-suggest --prefer-dist

# Cache Rector
- name: Cache Rector cache
uses: actions/cache@v3
with:
path: .rector/cache
key: ${{ runner.os }}-rector-${{ hashFiles('**/rector.php') }}
restore-keys: ${{ runner.os }}-rector-

# Run Rector
- name: Run Rector
run: |
vendor/bin/rector process \
--ansi
# Optional: Fail if Rector suggests changes
- name: Validate Rector changes
run: |
git diff --exit-code

0 comments on commit 245193a

Please sign in to comment.