chore: Added Prettier workflow for formatting (#152)
Co-authored-by: Jonah Lawrence <jonah@freshidea.com>pull/155/head
parent
cd6de9d3e0
commit
9581c33f83
@ -0,0 +1,43 @@
|
||||
name: Format with Prettier
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
paths:
|
||||
- "**.php"
|
||||
- "**.md"
|
||||
- "**.js"
|
||||
- "**.css"
|
||||
|
||||
jobs:
|
||||
prettier:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Pull Request
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Checkout Push
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install prettier and plugin-php
|
||||
run: npm install --global prettier @prettier/plugin-php
|
||||
|
||||
- name: Check formatting with Prettier
|
||||
continue-on-error: true
|
||||
run: composer format:check
|
||||
|
||||
- name: Prettify code
|
||||
run: composer format
|
||||
|
||||
- name: Commit changes
|
||||
uses: EndBug/add-and-commit@v9
|
||||
with:
|
||||
message: "style: Formatted code with Prettier"
|
||||
default_author: github_actions
|
@ -0,0 +1,2 @@
|
||||
vendor
|
||||
*.min.js
|
Loading…
Reference in New Issue