-
Notifications
You must be signed in to change notification settings - Fork 3
49 lines (40 loc) · 1.25 KB
/
prettier.yml
File metadata and controls
49 lines (40 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Format code with Prettier
on:
pull_request:
branches:
- main
permissions:
contents: write # Permite que la acción haga push de los cambios
jobs:
prettier:
name: Format code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Necesitamos hacer checkout de la rama del PR para poder hacer push de vuelta.
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Configure Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Prettier
run: pnpm exec prettier --write .
- name: Check formatting
run: |
# Check if there are changes in the working directory after Prettier
if git diff --quiet; then
echo "✅ There are no format changes. Everything is clean!"
exit 0
else
echo "❌ Code formatting issues found. Please run 'pnpm exec prettier --write .' locally and commit the changes."
git diff --name-only
exit 1
fi