Skip to content

✨ Feat: add new layouting provider, and layout for dashboard #1

✨ Feat: add new layouting provider, and layout for dashboard

✨ Feat: add new layouting provider, and layout for dashboard #1

name: Code Formatting
on:
push:
# Hanya jalankan pada push ke branch utama (misalnya main atau master)
# Anda bisa menyesuaikannya
branches:
- dev
- temp
pull_request:
# Jalankan pada pull request untuk memastikan kode masuk sudah bersih
branches:
- dev
- temp
# permissions:
# contents: write # <--- TAMBAHKAN DI SINI
jobs:
format-code:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
# Penting: Checkout dengan kedalaman penuh agar bisa melakukan push balik jika ada perubahan
with:
fetch-depth: 0
# --- SETUP PHP & LARAVEL PINT ---
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: iconv, mbstring
coverage: none
# - name: Get Composer Cache Directory
# id: composer-cache
# run: echo "dir=$(composer config cache-dir)" >> $GITHUB_OUTPUT
# - name: Cache Composer dependencies
# uses: actions/cache@v4
# with:
# path: ${{ steps.composer-cache.outputs.dir }}
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
# restore-keys: ${{ runner.os }}-composer-
- name: Install Composer Dependencies
run: composer install --prefer-dist --no-progress
- name: 🎨 Run Laravel Pint (PHP Formatting)
run: ./vendor/bin/pint --test
continue-on-error: true
# Pint akan memformat file in-place
# --- SETUP NODE & PRETTIER ---
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # Gunakan versi Node.js LTS terbaru
- name: 📦 Install Prettier
# Asumsi Anda menggunakan Prettier sebagai dev dependency (npm install --save-dev prettier)
# Jika tidak, ganti dengan: npm install -g prettier
run: npm install
- name: 💅 Run Prettier (HTML, CSS, JS, Blade Formatting)
run: npx prettier --check .
continue-on-error: true
# Perintah ini akan memformat semua file yang didukung oleh Prettier in-place
# --- COMMIT & PUSH BALIK PERUBAHAN ---
# - name: ⚙️ Check for changes and Commit
# id: git-check
# run: |
# if [ -n "$(git status --porcelain)" ]; then
# echo "changes_detected=true" >> $GITHUB_OUTPUT
# echo "::notice title=Formatting Changes::Changes detected after running formatters."
# else
# echo "changes_detected=false" >> $GITHUB_OUTPUT
# echo "::notice title=Formatting Clean::No formatting changes needed."
# fi
# - name: 📤 Push Formatting Changes
# if: steps.git-check.outputs.changes_detected == 'true'
# uses: EndBug/add-and-commit@v9
# with:
# # File yang di-commit adalah semua perubahan
# message: '🖌️ Style: Apply automatic code formatting via GitHub Actions'
# # Gunakan token GITHUB_TOKEN bawaan untuk push
# github_token: ${{ secrets.GITHUB_TOKEN }}
# # Nama dan email bot
# author_name: GitHub Actions Bot
# author_email: actions-bot@users.noreply.github.com