Skip to content

Commit

Permalink
add prettier action
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Nov 20, 2024
1 parent 436cb90 commit 3a3ed7b
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 7 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Prettier

on:
push:
branches: [main]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
run:
name: Can the code be prettier? 🤔
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: pnpm
node-version: lts/*
- run: pnpm install
- run: pnpm format
- run: git restore .github/workflows
- uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.ECOSPARK_APP_ID }}
private-key: ${{ secrets.ECOSPARK_APP_PRIVATE_KEY }}
- uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7
with:
body: I ran `pnpm format` 🧑‍💻
branch: actions/prettier
commit-message: "chore(prettier): 🤖 ✨"
labels: 🤖 bot
sign-commits: true
title: "chore(prettier): 🤖 ✨"
token: ${{ steps.generate-token.outputs.token }}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
},
"prettier": "@sanity/prettier-config",
"dependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.4.0",
"@sanity/prettier-config": "^1.0.3",
"prettier": "^3.3.3"
"prettier": "^3.3.3",
"prettier-plugin-astro": "^0.14.1",
"prettier-plugin-svelte": "^3.2.8",
"prettier-plugin-tailwindcss": "^0.6.9"
},
"packageManager": "[email protected]"
}
78 changes: 72 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions prettier.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const preset = require('@sanity/prettier-config')

module.exports = {
...preset,
plugins: [
...preset.plugins,
'@ianvs/prettier-plugin-sort-imports',
'prettier-plugin-astro',
'prettier-plugin-svelte',
'prettier-plugin-tailwindcss',
],
}

0 comments on commit 3a3ed7b

Please sign in to comment.