Skip to content

Commit

Permalink
prettier: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
elsongabriel committed Sep 3, 2024
1 parent 3e23cb0 commit 28d59dc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
29 changes: 18 additions & 11 deletions .github/workflows/prettier-php.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
name: Format Prettier

on:
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
types: [opened, synchronize, reopened, ready_for_review]

jobs:
cancel-runs:
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/main'
Expand All @@ -14,38 +15,44 @@ jobs:
access_token: ${{ github.token }}

prettier:
if: ${{ github.ref != 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Set up Git
if: ${{ github.ref != 'refs/heads/main' }}
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
- name: Actions checkout
if: ${{ github.ref != 'refs/heads/main' }}
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Cache Node.js dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Setup Node.js
if: ${{ github.ref != 'refs/heads/main' }}
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install Dependencies
if: ${{ github.ref != 'refs/heads/main' }}
run: npm install prettier @prettier/plugin-php stylelint-prettier

- name: Run prettier code format
if: ${{ github.ref != 'refs/heads/main' }}
run: npx prettier --write **/*.{php,js} --plugin=@prettier/plugin-php --ignore-unknown && npx stylelint **/*.css --fix
- name: Run Prettier and Stylelint
run: |
npx prettier --write "**/*.{php,js}" --plugin=@prettier/plugin-php --ignore-unknown
npx stylelint "**/*.css" --fix
shell: bash

- name: Run add and commit
if: ${{ github.ref != 'refs/heads/main' }}
- name: Commit Changes
uses: EndBug/add-and-commit@v9
with:
author_name: GitHub Actions
Expand Down
13 changes: 11 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@ system/cache
system/php_sessions
node_modules

# Tools
tools/*.css
tools/fonts
tools/js
tools/tinymce

# Files
login.php
clientcreateaccount.php

# Styles
admin/bootstrap/pace/templates/pace-theme-loading-bar.tmpl.css
admin/bootstrap/pace/templates/pace-theme-mac-osx.tmpl.css
admin/bootstrap/

# Extensions
*.min.js"
*.min.css"

0 comments on commit 28d59dc

Please sign in to comment.