Skip to content

Commit 6f28630

Browse files
committed
Add CI workflow to check for Prettier formatting compliance
On every push and pull request that affects relevant files, and periodically, check whether the formatting of supported files is compliant with the Prettier style.
1 parent caca294 commit 6f28630

File tree

3 files changed

+224
-0
lines changed

3 files changed

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

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[![Check Go status](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-go.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-go.yml)
2+
[![Check Prettier Formatting status](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-prettier-formatting-task.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-prettier-formatting-task.yml)
23
[![Spell Check status](https://github.com/arduino/libraries-repository-engine/actions/workflows/spell-check-task.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/spell-check-task.yml)
34

45
BUILD

Taskfile.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ tasks:
4747
cmds:
4848
- go fmt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
4949

50+
general:format-prettier:
51+
desc: Format all supported files with Prettier
52+
cmds:
53+
- npx prettier --write .
54+
5055
general:check-spelling:
5156
desc: Check for commonly misspelled words
5257
cmds:

0 commit comments

Comments
 (0)