Skip to content

Commit 83dc2b0

Browse files
Merge pull request #28 from arduino/prettier-formatting
Add CI workflow to check for Prettier formatting compliance
2 parents 0de8a7a + 838f391 commit 83dc2b0

File tree

8 files changed

+430
-165
lines changed

8 files changed

+430
-165
lines changed
Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-prettier-formatting-task.md
2+
name: Check Prettier Formatting
3+
4+
env:
5+
# See: https://github.com/actions/setup-node/#readme
6+
NODE_VERSION: 16.x
7+
8+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
9+
on:
10+
push:
11+
paths:
12+
- ".github/workflows/check-prettier-formatting-task.ya?ml"
13+
- "Taskfile.ya?ml"
14+
- "**/.prettierignore"
15+
- "**/.prettierrc*"
16+
# CSS
17+
- "**.css"
18+
- "**.wxss"
19+
# PostCSS
20+
- "**.pcss"
21+
- "**.postcss"
22+
# Less
23+
- "**.less"
24+
# SCSS
25+
- "**.scss"
26+
# GraphQL
27+
- "**.graphqls?"
28+
- "**.gql"
29+
# handlebars
30+
- "**.handlebars"
31+
- "**.hbs"
32+
# HTML
33+
- "**.mjml"
34+
- "**.html?"
35+
- "**.html.hl"
36+
- "**.st"
37+
- "**.xht"
38+
- "**.xhtml"
39+
# Vue
40+
- "**.vue"
41+
# JavaScript
42+
- "**.flow"
43+
- "**._?jsb?"
44+
- "**.bones"
45+
- "**.cjs"
46+
- "**.es6?"
47+
- "**.frag"
48+
- "**.gs"
49+
- "**.jake"
50+
- "**.jscad"
51+
- "**.jsfl"
52+
- "**.js[ms]"
53+
- "**.[mn]js"
54+
- "**.pac"
55+
- "**.wxs"
56+
- "**.[xs]s?js"
57+
- "**.xsjslib"
58+
# JSX
59+
- "**.jsx"
60+
# TypeScript
61+
- "**.ts"
62+
# TSX
63+
- "**.tsx"
64+
# JSON
65+
- "**/.eslintrc"
66+
- "**.json"
67+
- "**.avsc"
68+
- "**.geojson"
69+
- "**.gltf"
70+
- "**.har"
71+
- "**.ice"
72+
- "**.JSON-tmLanguage"
73+
- "**.mcmeta"
74+
- "**.tfstate"
75+
- "**.topojson"
76+
- "**.webapp"
77+
- "**.webmanifest"
78+
- "**.yyp?"
79+
# JSONC
80+
- "**/.babelrc"
81+
- "**/.jscsrc"
82+
- "**/.js[hl]intrc"
83+
- "**.jsonc"
84+
- "**.sublime-*"
85+
# JSON5
86+
- "**.json5"
87+
# Markdown
88+
- "**.mdx?"
89+
- "**.markdown"
90+
- "**.mk?down"
91+
- "**.mdwn"
92+
- "**.mkdn?"
93+
- "**.ronn"
94+
- "**.workbook"
95+
# YAML
96+
- "**/.clang-format"
97+
- "**/.clang-tidy"
98+
- "**/.gemrc"
99+
- "**/glide.lock"
100+
- "**.ya?ml*"
101+
- "**.mir"
102+
- "**.reek"
103+
- "**.rviz"
104+
- "**.sublime-syntax"
105+
- "**.syntax"
106+
pull_request:
107+
paths:
108+
- ".github/workflows/check-prettier-formatting-task.ya?ml"
109+
- "Taskfile.ya?ml"
110+
- "**/.prettierignore"
111+
- "**/.prettierrc*"
112+
# CSS
113+
- "**.css"
114+
- "**.wxss"
115+
# PostCSS
116+
- "**.pcss"
117+
- "**.postcss"
118+
# Less
119+
- "**.less"
120+
# SCSS
121+
- "**.scss"
122+
# GraphQL
123+
- "**.graphqls?"
124+
- "**.gql"
125+
# handlebars
126+
- "**.handlebars"
127+
- "**.hbs"
128+
# HTML
129+
- "**.mjml"
130+
- "**.html?"
131+
- "**.html.hl"
132+
- "**.st"
133+
- "**.xht"
134+
- "**.xhtml"
135+
# Vue
136+
- "**.vue"
137+
# JavaScript
138+
- "**.flow"
139+
- "**._?jsb?"
140+
- "**.bones"
141+
- "**.cjs"
142+
- "**.es6?"
143+
- "**.frag"
144+
- "**.gs"
145+
- "**.jake"
146+
- "**.jscad"
147+
- "**.jsfl"
148+
- "**.js[ms]"
149+
- "**.[mn]js"
150+
- "**.pac"
151+
- "**.wxs"
152+
- "**.[xs]s?js"
153+
- "**.xsjslib"
154+
# JSX
155+
- "**.jsx"
156+
# TypeScript
157+
- "**.ts"
158+
# TSX
159+
- "**.tsx"
160+
# JSON
161+
- "**/.eslintrc"
162+
- "**.json"
163+
- "**.avsc"
164+
- "**.geojson"
165+
- "**.gltf"
166+
- "**.har"
167+
- "**.ice"
168+
- "**.JSON-tmLanguage"
169+
- "**.mcmeta"
170+
- "**.tfstate"
171+
- "**.topojson"
172+
- "**.webapp"
173+
- "**.webmanifest"
174+
- "**.yyp?"
175+
# JSONC
176+
- "**/.babelrc"
177+
- "**/.jscsrc"
178+
- "**/.js[hl]intrc"
179+
- "**.jsonc"
180+
- "**.sublime-*"
181+
# JSON5
182+
- "**.json5"
183+
# Markdown
184+
- "**.mdx?"
185+
- "**.markdown"
186+
- "**.mk?down"
187+
- "**.mdwn"
188+
- "**.mkdn?"
189+
- "**.ronn"
190+
- "**.workbook"
191+
# YAML
192+
- "**/.clang-format"
193+
- "**/.clang-tidy"
194+
- "**/.gemrc"
195+
- "**/glide.lock"
196+
- "**.ya?ml*"
197+
- "**.mir"
198+
- "**.reek"
199+
- "**.rviz"
200+
- "**.sublime-syntax"
201+
- "**.syntax"
202+
schedule:
203+
# Run periodically to catch breakage caused by external changes.
204+
- cron: "0 4 * * WED"
205+
workflow_dispatch:
206+
repository_dispatch:
207+
208+
jobs:
209+
check:
210+
runs-on: ubuntu-latest
211+
212+
steps:
213+
- name: Checkout repository
214+
uses: actions/checkout@v3
215+
216+
- name: Setup Node.js
217+
uses: actions/setup-node@v3
218+
with:
219+
node-version: ${{ env.NODE_VERSION }}
220+
221+
- name: Install Task
222+
uses: arduino/setup-task@v1
223+
with:
224+
repo-token: ${{ secrets.GITHUB_TOKEN }}
225+
version: 3.x
226+
227+
- name: Format with Prettier
228+
run: task general:format-prettier
229+
230+
- name: Check formatting
231+
run: git diff --color --exit-code

0 commit comments

Comments
 (0)