-
Notifications
You must be signed in to change notification settings - Fork 6
44 lines (37 loc) · 1.17 KB
/
prettier.yml
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
name: Lint
on:
pull_request:
push:
branches:
- main
jobs:
prettier:
name: Prettier
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up pnpm
uses: pnpm/[email protected]
with:
version: latest
- name: Install dependencies
run: pnpm install
- name: Check for formatting issues
id: prettier-check
run: |
pnpm exec prettier --check "**/*.{js,jsx,ts,tsx,json,css,md}" || echo "formatting-required"
- name: Comment on the PR if formatting is required
if: steps.prettier-check.outputs.formatting-required
uses: actions/github-script@v7
with:
script: |
const issue_number = context.payload.pull_request.number;
github.rest.issues.createComment({
issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Some files aren't properly formatted. Would you like me to lint them for you?"
})
- name: Run Prettier
run: pnpm exec prettier --check "**/*.{js,jsx,ts,tsx,json,css,md}"